Skip to content
Sıfırıncı Dakika
Latest

Google adds Tool Retrieval to the Gemini API so large tool libraries aren't sent on every request

AI2 min read

In brief

Google has previewed Tool Retrieval in the Gemini API. The feature stops agents from sending parameter schemas for dozens of functions or MCP servers on every request; a schema loads only when the model needs that tool. It currently runs only in the v1beta Interactions API.

  • Tool schemas load only when needed
  • Server-side (default) or client-side retrieval
  • Defer all tools from an MCP server with one setting
  • One tool_search entry per request
  • No separate fee, standard token rates apply
  • Interactions API v1beta only

What changes?

Google has added a feature called Tool Retrieval to the Gemini API. It is available in preview only in the v1beta Interactions API. The goal is to stop agents wired to many functions or MCP servers from sending every tool definition on each request.

According to Google's documentation, a few dozen function declarations can consume tens of thousands of tokens per request. Under the new approach the model sees only each tool's name and a short description; the parameter schema loads only when that tool is needed.

How it works

You add {"type": "tool_search"} to the tools array and set defer_loading: true on each function to hold back. When the model needs a deferred tool, the response moves in three steps: the model requests the tool by name, the API returns the full schema, then the model emits the call. The API resolves the first two steps itself; your app only runs the function call and returns the result.

Server-side vs client-side

The default is server-side: Gemini runs the search, so there is no index to build or host. In client-side mode your app runs its own lookup, such as an embedding index or permission filter, and returns matching declarations. That mode adds one extra round trip per search. The two modes cannot be combined in one request, and only one tool_search entry is allowed per request.

MCP and caching

Setting defer_loading: true on an mcp_server entry defers every tool that server exposes; those tools still execute remotely through Gemini API's MCP support. Deferred schemas stay out of the prompt prefix, so implicit caching still applies. The docs add a catch: deferring tools can shrink a prompt below the minimum cacheable size.

Cost and rivals

There is no separate fee; tokens bill at the model's standard input, cached and output rates. Each server-side search triggers an extra model call over the full context, billed at the input rate under total_tool_use_tokens. Google notes static loading can cost less for small libraries or per-turn searches. Anthropic and OpenAI already ship similar tool search features.

Why it matters

For readers building agents, this directly affects context windows and token costs; teams wiring many tools may need to revisit their architecture.

Sources

Related stories