はじめに
MCP のツール定義は,
多くのトークンを消費しコンテキストを圧迫してしまうことがあります.
コンテキストをより効率的に使用するため,
今回は Claude Code で Tool search tool を使う方法を試してみます.
The tool search tool enables Claude to work with hundreds or thousands of tools by dynamically discovering and loading them on-demand. Instead of loading all tool definitions into the context window upfront, Claude searches your tool catalog—including tool names, descriptions, argument names, and argument descriptions—and loads only the tools it needs.
This approach solves two critical challenges as tool libraries scale:
- Context efficiency: Tool definitions can consume massive portions of your context window (50 tools ≈ 10-20K tokens), leaving less room for actual work
- Tool selection accuracy: Claude's ability to correctly select tools degrades significantly with more than 30-50 conventionally-available tools
前提
- Claude Code v2.0.76 を使用
- MCP サーバとして以下の2つを登録
- chrome-devtools
- codex
Tool search tool 無効(デフォルト)
MCP tools だけで 19.8k tokens (9.9%) を消費しており,
MCP のツール定義がコンテキストを大きく占有していることがわかります.
Tool search tool 有効化
以下のように環境変数を指定して claude を起動するだけです.
$ ENABLE_TOOL_SEARCH=true claude
MCP tools が loaded on-demand となり,
MCP のツール定義が初期コンテキストに含まれていないことが確認できます.
その結果, Free space は 117k → 136k に増加しました.
ツール使用後のコンテキストを確認
Tool search tool を有効化した状態で,
chrome-devtools を実際に使用した場合の挙動を確認します.
当初は mcp__chrome-devtools__* すべて読み込まれると想定していましたが,
実際には指示に対して必要なツールのみが読み込まれました.
まとめ
- Tool search tool を有効化することで, MCP ツール定義による初期コンテキスト消費を大幅に削減できる
- ツール使用時も, 必要最小限のツールだけが読み込まれる
- 多数の MCP ツールを登録している環境では特に有効な設定といえる





