refactor(mcp): simplify tools collection using maps.Collect

林玮 (Jade Lin) created

- Replace manual map construction with maps.Collect for MCP tools
- Remove redundant loop that iterated over mcpTools.Seq2()
- Maintain same functionality with cleaner, more idiomatic code

Change summary

internal/llm/agent/agent.go | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

Detailed changes

internal/llm/agent/agent.go 🔗

@@ -213,11 +213,8 @@ func NewAgent(
 		mcpToolsOnce.Do(func() {
 			doGetMCPTools(ctx, permissions, cfg)
 		})
-		result := make(map[string]tools.BaseTool)
-		for _, mcpTool := range mcpTools.Seq2() {
-			result[mcpTool.Name()] = mcpTool
-		}
-		return result
+
+		return maps.Collect(mcpTools.Seq2())
 	}
 
 	a := &agent{