What is tool search? Loading AI tools on demand
By Flavio
Tool search loads tool definitions when a coding agent needs them. Learn how deferred MCP tools save context, with an example from a real Claude Code session.
Tool search lets an agent find relevant tools and load their definitions when it needs them. Deferring those definitions leaves more of the context window available for your code and conversation.
What is MCP? includes a measured example from this site’s Claude Code setup. That tutorial owns the connection setup and full context-cost walkthrough.
How tool search works
A tool definition explains what an operation does and which arguments it accepts. Loading every definition upfront can take substantial context when you connect several MCP servers.
With deferred tools, the host gives the model a way to find tools first. It loads the matching definitions before the model calls them.
This search finds operations. A tool named search_posts searches content after it has been discovered and called.
In coding tools
Claude Code enables MCP tool search by default on supported models and deployments. Tool names and server instructions load at startup, while full definitions load on demand (some deployments still fall back to loading definitions upfront).
The MCP guides for Codex, Cursor, and Grok Build describe connecting external tools. Those pages do not document the same tool-search configuration switch. Follow the settings for the client you use.
Details checked against each vendor’s documentation in November 2026.
A real example
The filesystem walkthrough records this sequence in a Claude Code session:
TOOL_USE ToolSearch {"query":"select:mcp__practice-files__read_text_file","max_results":1}
TOOL_USE mcp__practice-files__read_text_file {"path":"/tmp/mcp-practice/cron.md","head":5}
The first call loads the file-reading tool. The second reads the file. These are recorded tool calls, rather than shell commands to paste into your terminal.
When to use it
Tool search helps when connected servers expose many operations. If a tool seems missing, check whether it is deferred, whether its server connected, and whether the agent can discover it.
When writing a server, make its instructions explain when its tools help. Put useful search words near the start of tool descriptions.
Pitfalls
Deferring a definition doesn’t reduce the size of the tool’s result. A file-reading tool can still fill the conversation with text. Ask for the relevant section or use pagination.
Tool search also leaves permissions and credentials in the host and server. Loading a definition grants no new access.
Related on flaviocopes.com
- What is MCP? shows real tool definitions and context measurements.
- The Claude Code guide covers the wider setup and context controls.
- Discover CLI tools for coding agents uses CLI Tools Cabinet to find installed commands. That is a separate discovery path for shell tools.
Related glossary entries
- Context window: The context window is everything a coding agent can see at once. How to check it, free it and keep it small in Claude Code, Codex, Cursor and Grok Build.
- Tool calling: Tool calling is when a model names a function and its arguments, and the app runs it. How Claude Code, Codex, Cursor and Grok Build take that step.
- MCP resources: MCP resources expose files, schemas, and other context through a server. Learn how clients read them, how Claude Code references them, and common pitfalls.
All AI glossary entries → · AI for coding hub →
Want me to talk about your product? You can sponsor this site.