fix: add mcps after the filter

kujtimiihoxha created

Change summary

internal/llm/agent/agent.go | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

Detailed changes

internal/llm/agent/agent.go 🔗

@@ -197,15 +197,6 @@ func NewAgent(
 			tools.NewWriteTool(lspClients, permissions, history, cwd),
 		}
 
-		mcpToolsOnce.Do(func() {
-			mcpTools = doGetMCPTools(ctx, permissions, cfg)
-		})
-		allTools = append(allTools, mcpTools...)
-
-		if len(lspClients) > 0 {
-			allTools = append(allTools, tools.NewDiagnosticsTool(lspClients))
-		}
-
 		if agentCfg.AllowedTools == nil {
 			return allTools
 		}
@@ -216,6 +207,17 @@ func NewAgent(
 				filteredTools = append(filteredTools, tool)
 			}
 		}
+
+		if agentCfg.ID == "coder" {
+			mcpToolsOnce.Do(func() {
+				mcpTools = doGetMCPTools(ctx, permissions, cfg)
+			})
+			filteredTools = append(filteredTools, mcpTools...)
+			if len(lspClients) > 0 {
+				filteredTools = append(filteredTools, tools.NewDiagnosticsTool(lspClients))
+			}
+
+		}
 		return filteredTools
 	}