Definition
On-demand MCP tool loading is a pattern where an AI agent loads MCP tool definitions into its context window only when needed, rather than preloading all available tools at conversation start, reducing context window consumption and improving focus.
In Depth
Every MCP tool definition consumes tokens in the LLM's context window: the tool name, description, parameter schema, and examples can add hundreds or thousands of tokens per tool. When an agent has access to 20+ MCP servers with 5-10 tools each, preloading all definitions can consume 10-30% of the available context window before any actual conversation begins. On-demand loading solves this by deferring tool schema loading until the agent determines it needs a specific capability. Claude Code implements this pattern: MCP servers are configured in the project's mcp.json, but their tool schemas are not loaded into every conversation. When the user's request suggests a tool might be needed (e.g., mentioning search, web data, or a specific platform), the agent dynamically loads the relevant MCP server's tools. This keeps the context window lean for conversations that do not require external tools while maintaining full tool access when needed. The tradeoff: on-demand loading adds a small latency hit when tools are first loaded (the agent must fetch and parse the MCP server's tool list), and the agent might occasionally fail to load a tool it should have because it did not recognize the need. Explicit tool invocation (the user typing a tool name or using a slash command) bypasses this issue. For agents with many MCP connections, on-demand loading is essential -- without it, the context window fills up with tool definitions that may never be used in a given session.
Example Usage
A developer has Scavio, GitHub, Postgres, and Slack MCP servers configured in Claude Code. When they ask a coding question, none of the MCP tools are loaded -- full context window available for code. When they ask 'what are the top results for [keyword]?', Claude Code loads the Scavio MCP tools on demand and executes the search.
Platforms
On-Demand MCP Tool Loading is relevant across the following platforms, all accessible through Scavio's unified API:
- Amazon
- YouTube
- Walmart