Gemini API: Tool Retrieval Lets Agents Load Function Schemas On Demand
Google added tool retrieval in Preview to the Gemini Interactions API, letting the model search a tool library and load function schemas only when needed. Tools are marked with defer_loading: true alongside a tool_search tool, and remote MCP servers support deferral too. The feature works with Gemini 3.6 and later, including all Gemini 4 models.
Key Takeaways
- Tool retrieval is in Preview in the Gemini Interactions API, targeting agents with large tool libraries.
- Tools marked
defer_loading: trueare not sent in full, and atool_searchtool lets the model find them on demand. - Setting
execution: "client"allows developers to plug in their own retrieval logic. - Remote MCP servers support
defer_loading, helping agents connected to many tools keep context small. - It works with Gemini 3.6 and later, including all Gemini 4 models.
- The main benefit is less context spent on unused function schemas, since only the tools needed are loaded.
Stop Sending Every Tool on Every Request
Google introduced tool retrieval in Preview for the Gemini Interactions API on November 19, 2026. Agents with large tool sets previously had to include every function schema in each request, which consumed context and slowed responses. With tool retrieval, the API can search the tool library and load only the schemas the model actually needs.
How It Works
Deferred Loading
Developers mark tools with defer_loading: true. Deferred tools are not sent to the model in full up front. Instead, a tool_search tool is added to the request, and the model uses it to find relevant tools and pull in their function schemas on demand.
Bring Your Own Retrieval
For teams that already have their own search or ranking logic, setting execution: "client" lets the application handle retrieval itself. This keeps control over how tools are matched, while still benefiting from deferred loading.
Remote MCP Servers
Remote MCP servers also support defer_loading. Agents connected to servers that expose many tools can therefore keep their context small and load specific tools only when a task calls for them.
Model Support
Tool retrieval works with Gemini 3.6 and later in the Interactions API, including all Gemini 4 models. The feature is in Preview, so behavior and parameters may change before general availability.
Why It Matters
Large tool catalogs are common in coding agents and enterprise assistants, where dozens or hundreds of tools compete for context. Loading schemas on demand reduces token usage and can improve tool selection accuracy, making it practical to connect many tools and MCP servers to one agent.