How Claude Code's Tool Search Saves 90% of Your Context Window
Claude Code's tool search feature defers loading of MCP tool definitions, reducing token overhead and preserving context window for actual work.
Why it matters
This feature represents a fundamental shift in how Claude Code handles tool ecosystems, reducing token overhead and preserving context window.
Key Points
- 1Tool search replaces multiple MCP tool definitions with a single search tool that loads tools on-demand
- 2This reduces token overhead from ~90,000 to ~15,000 tokens immediately
- 3Tool search operates in three modes to balance savings and latency
- 4Discovered tools are preserved across context compaction through a snapshot system
Details
Claude Code's tool search feature automatically defers loading of MCP tool definitions, replacing them with a single search tool that loads tools on-demand. This reduces the token overhead from ~90,000 to ~15,000 tokens immediately, preserving the context window for actual work. The system uses a priority-ordered checklist to determine which tools to defer, with the goal of 'fail closed, fail toward asking' - if anything is uncertain, the system loads all tools rather than hiding them. Tool search operates in three modes - the default 'tst' mode always defers MCP and 'shouldDefer' tools, 'tst-auto' mode defers based on a token budget threshold, and 'standard' mode never defers. Discovered tools are preserved across context compaction through a snapshot system, ensuring Claude doesn't lose access to tools it's already discovered.
No comments yet
Be the first to comment