-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Feature Request: Deferred MCP Tool Loading + Tool Search Tool #979
Description
Problem
When an agent is configured with a large number of MCP tools — for example, one tool per 3rd-party Graph connector registered in an organization (Jira, Salesforce, ServiceNow, Azure DevOps, and potentially 100+ others) — sending every tool schema to the model upfront causes significant context window bloat.
Each MCP tool schema typically occupies several hundred tokens. At 100+ connectors, this consumes a meaningful fraction of the context budget before any user message or grounding work has begun. It also degrades model performance: the model attends to a long list of tools it will never need for a given request.
What we need
-
Deferred (lazy) MCP tool loading
Tools should be registerable without their schemas being eagerly included in the model's context. A deferred tool is declared to the runtime but its full schema (name, description, input spec) is withheld until the model explicitly requests it. Claude's agent SDK already implements this via an isMcp: true flag on tool registrations. When set, the tool is held back from the initial tool list. The GHCP SDK has no equivalent. -
ToolSearch — a tool for discovering deferred tools at runtime
The model needs a first-class tool to query the deferred tool registry by keyword or semantic description and retrieve matching schemas on demand. Claude's agent SDK exposes this as a ToolSearch tool with a query parameter and a max_results cap; matched tool schemas are injected into the model's context only when needed.