How many tools should an MCP server have? I measured 5 to 100 in Claude Code, Codex and Gemini
说明与用途
所有测试的工具数量(5–100)都实现了100%的准确性,但成本和上下文取决于工具的加载方式。Claude Code中的工具搜索在工具数量较多时可减少令牌,但会增加一次额外调用。仅在所有模式都被预加载时,工具分组才会节省成本。
问题
Determining the optimal number of tools for an MCP server to balance accuracy, cost, and context across different LLM clients.
结果
Accuracy remained 100 % from 5 to 100 tools; cost differences were driven by tool loading strategy (search on/off, eager vs deferred) rather than tool count. Tool search in Claude Code reduced input tokens above ~19 tools but increased cost slightly due to an extra call. Grouping tools saved cost only when all schemas were eagerly loaded.
工作流
- 1. Reviewed 91 MCP server design sources to gather existing recommendations.
- 2. Built a fake MCP server with 100 realistic file‑handling tools, including look‑alike and vague‑named variants.
- 3. Ran 18 tasks (10 ambiguous) across tool counts 5, 10, 20, 30, 50, 75, 100, each twice, with three clients.
- 4. Collected input token counts for first call and per run under different loading modes.
- 5. Analyzed accuracy, token cost, and impact of tool search, grouping, and naming.
- 6. Summarized findings and provided actionable guidance.
证据
Every run with separate tools was fully correct, from 5 to 100 tools, in all three clients and in both Claude Code modes.
Tool search is the switch that matters in Claude Code. It's on by default: only tool names go into the prompt, and the model loads the schemas it needs with one ToolSearch call.
With every schema loaded (Claude Code, search off), 7 grouped tools cost what 14 separate ones do, at 100% accuracy.
Names that misled most often: "3 JPGs into one PDF" led to combine_files, which actually merges PDFs; "shrink a PNG" led to optimize_image; and pptx and docx to PDF got mixed up between convert_file and convert_document.
- 记录日期: 2026-10-14T20:56:07.719Z