Gemini API Introduces Tool Retrieval for Efficient Agent Scaling
Google AI recently announced the introduction of Tool Retrieval in the Gemini API, a new feature aimed at improving how AI agents handle extensive tool libraries. The update is currently available in preview through the Interactions API and targets developers building complex systems that rely on function calling. According to Google's blog post, Tool Retrieval addresses performance bottlenecks caused by including full tool parameter schemas in every prompt, which can inflate input tokens and slow down response times.
This enhancement allows agents to maintain a large tool library in standby while only pulling in the relevant schemas during specific tasks. The result is faster execution, lower token costs, and improved accuracy in tool selection as models no longer have to process overwhelming amounts of redundant data.
What Is Tool Retrieval?
Tool Retrieval is a new feature in the Gemini API that allows agents to defer loading full tool parameter schemas until they are actually needed. Instead of sending all tool details with every request, developers can store a large library of tools and load only those required for a specific task. This approach significantly reduces input token usage and latency, especially when working with hundreds of tools.
The mechanism supports both server-side and client-side retrieval methods, offering flexibility in how tools are managed. It integrates seamlessly with the existing function calling paradigm, ensuring that models still have full visibility into available tools while keeping the context clean. Developers can enable this by adding a tool_search tool and setting defer_loading: true on tools they wish to defer.
In practice, this means agents can keep frequently used tools loaded upfront while deferring less common ones. When a model needs a deferred tool, it requests the schema by name, and the API loads it within the same interaction. This process is efficient, maintains accuracy in tool selection, and works well with prefix caching to preserve performance across conversations.
Tool Retrieval also supports integration with remote MCP servers, where entire tool sets from external sources can be loaded on demand without listing them individually. This enhances scalability for complex applications that rely on large or dynamic tool ecosystems.

How Tool Retrieval Works
To enable Tool Retrieval in the Gemini API, developers must include a tool_search tool in their requests and set defer_loading: true on tools they wish to defer. This setup allows the model to see the names and descriptions of all deferred tools without loading their full parameter schemas into the prompt context. By deferring schema details, the system reduces token usage and improves performance when managing large tool libraries.
The process unfolds in three steps within a single API interaction: tool search call, tool search result, and function call with arguments. When the model decides on a tool, it makes a search request by name, and the API loads only that specific schema. This targeted loading ensures minimal token overhead while maintaining full functionality. Developers can inspect these steps in interaction.steps to debug or analyze which tools were considered during a conversation.
Tool Retrieval supports integration with remote MCP servers, enabling deferred loading of tools from external sources without explicitly listing them. This capability allows developers to connect large tool sets dynamically and efficiently, reducing the need for upfront schema transmission. It also works well with prefix caching, as deferred schemas are added later in the conversation, preserving cached prompt prefixes across turns.
This mechanism is available in the Interactions API and supports Gemini 3.6 and later models. Developers can keep frequently used tools loaded while deferring others, optimizing both speed and accuracy. The feature simplifies tool management for complex agents and lowers input token costs during function calling.
Why This Matters for AI Agents
As AI agents grow more sophisticated, they often need access to hundreds of tools, each with its own schema. Including every tool's full parameter details in every interaction causes increased latency, higher input token costs, and can reduce accuracy in tool selection. Tool Retrieval addresses this by allowing models to access a vast tool library while only loading specific tool schemas when needed.
This approach keeps the context window manageable, improving performance and scalability for large-scale agent systems. Developers can now keep most tools in a deferred state, loading their schemas only during function calls. It also enhances debugging, as the API logs which tools were considered, making it easier to trace decisions.
The feature works by adding a tool_search tool and setting defer_loading: true on tools that should be loaded on demand. When the model requests a specific tool, the API retrieves its schema and integrates it into the same request. This process is seamless, requiring only minor code changes, and supports both local and remote MCP servers.
Tool Retrieval also integrates well with prefix caching, maintaining consistent performance across conversations. It enables more efficient agent architectures, especially in enterprise settings where tools are numerous but not all used simultaneously. Developers can optimize for speed and cost while maintaining flexibility in tool access.

Who Benefits Most from This Update?
Developers building complex AI agents will see the greatest benefit from Tool Retrieval, especially those managing large tool libraries or integrating with external systems like CRMs, payment platforms, or analytics tools. By loading parameter schemas only when needed, the feature significantly reduces input token usage and latency. This allows for more efficient prompt handling and improves accuracy in tool selection as agent complexity grows.
Prompt engineers designing intricate workflows will find that Tool Retrieval simplifies context management. It decouples tool availability from prompt size, enabling scalable agents without sacrificing precision. The ability to defer loading of less-used tools while keeping frequently accessed ones readily available streamlines development and reduces overhead.
Teams using remote MCP servers or custom registries can leverage client-side retrieval for dynamic tool discovery during conversations. This is especially useful for platforms where users connect new integrations on the fly. With defer_loading set to true, tools are loaded on demand, reducing initial context size and improving performance without requiring manual indexing or hosting.
The feature supports Gemini 3.6 and later models, works seamlessly with prefix caching, and integrates smoothly into existing function calling flows. Developers simply add a tool_search tool and set defer_loading: true on tools they want to defer. This minimal change unlocks scalable agent architectures while maintaining full control over tool access and execution.
What Can Developers Do With Tool Retrieval?
Developers can begin leveraging Tool Retrieval by identifying frequently used tools and loading them upfront, while deferring less common ones to reduce initial input token usage. This strategy improves performance and scalability as agent toolsets grow. To implement this in code, developers add a tool_search tool and set defer_loading: true on tools they wish to defer. For server-side scenarios, the schema loading occurs automatically within the same API request, streamlining the process.
For client-side retrieval, developers must define the tool_search with execution set to client, then implement logic to return matching schemas when a function call is triggered. This allows dynamic tool discovery based on user permissions or integration status, offering flexibility in agent behavior and access control. Such an approach supports personalized experiences and secure tool usage without compromising performance.
Testing Tool Retrieval's impact on token consumption and latency in real-world applications is recommended before full deployment. The feature works with Gemini 3.6 and later models, ensuring compatibility with advanced agent tasks. It also integrates well with prefix caching, maintaining cached prompt efficiency across conversations by keeping deferred schemas out of the initial context.
Additionally, Tool Retrieval supports remote MCP servers. By setting defer_loading: true on an mcp_server tool, all tools exposed by that server are loaded on demand, simplifying integration of large external tool libraries without listing each one individually. This enhances developer productivity and scalability in complex agent architectures.
Pricing and Model Compatibility
Tool Retrieval in the Gemini API is now available at no extra cost, with input and output tokens billed at standard rates. There’s no additional fee for using tool_search, and each tool schema loaded during a conversation is treated like any other input token. This design ensures developers can adopt the feature without worrying about unexpected pricing impacts.
The functionality supports all Gemini 3.6 and later models, including the newest Gemini 4 models, and is accessible via the Interactions API. By loading tool schemas only when needed, developers reduce input token usage compared to traditional methods where full tool libraries are sent upfront. This leads to lower latency, improved performance, and better accuracy in tool selection as agent complexity grows.
Developers should monitor their usage patterns before fully integrating this approach into large-scale systems, as token savings depend on how frequently tools are invoked. The feature also integrates well with prefix caching, allowing cached prompts to remain stable across turns while deferred schemas are added later in the conversation.
For those using remote MCP servers, Tool Retrieval supports defer_loading: true on mcp_server tools, enabling dynamic loading of large tool sets without pre-defining each one. This enhances flexibility and scalability for complex agent architectures.
What’s Next for Tool Retrieval?
Tool Retrieval represents a significant evolution in how AI agents interact with large tool libraries, addressing key inefficiencies in token usage and performance. By deferring the loading of full parameter schemas until a tool is actually needed, developers can reduce input token counts and latency. This approach improves accuracy as tool selection becomes less cluttered by irrelevant information, especially when agents scale to manage dozens or hundreds of tools.
The feature is now available in preview through the Gemini Interactions API, where developers can enable it by adding a tool_search tool and setting defer_loading: true on specific functions. When the model requires a function, it requests the schema on-demand, allowing for efficient processing within a single API call. This mechanism supports both local and remote MCP servers, enabling seamless integration with large-scale tool providers without listing every function individually.
For developers, this means more scalable agent architectures that maintain responsiveness even as complexity grows. Prompt engineers and AI architects should pay close attention to evolving documentation around best practices for organizing tool libraries and optimizing performance across use cases. The ability to keep frequently used tools loaded while deferring others ensures balanced efficiency.
Future enhancements may expand support for various tool sources and deepen integration with existing AI frameworks, further streamlining agent development. As adoption increases, Google is likely to refine Tool Retrieval based on real-world feedback, making it a core component of scalable AI workflows.
Frequently asked questions
What is the main benefit of Tool Retrieval?
It reduces input token usage and latency by loading tool schemas only when needed, improving performance for large tool libraries.
How do I enable Tool Retrieval in my code?
Add a tool_search tool and set defer_loading: true on the tools you want to defer. This works with the Interactions API and Gemini 3.6+ models.
Can I use Tool Retrieval with remote MCP servers?
Yes, deferred loading works with remote MCP servers, allowing large tool sets to be loaded on demand without listing them individually.
Final thoughts
Tool Retrieval in the Gemini API is a significant advancement for developers managing complex AI agents. By deferring tool schema loading, it cuts down on token costs and latency, making it easier to scale tools without compromising performance. As AI systems grow more sophisticated, such optimizations will be essential for maintaining efficiency and responsiveness.