ANTM

Gemini API Tool Retrieval: How defer_loading Works and When It Saves Tokens

Google's Gemini API can now hold back most of an agent's tool schemas and load them only when the model asks. What the preview does, what the documentation says it costs, and a way to decide whether it helps your agent.

Editorial desk

Published 6 min read

A dense strip of cyan dots on the left fans out into converging lines on the right, from which three lines rise to a single coral dot, on a black background
Illustration generated with AI (FLUX.1 [schnell] (Black Forest Labs) via Cloudflare Workers AI, Apache 2.0). Prompt and direction by ANTM.

An agent connected to a few hundred tools has a hidden tax: every request carries every tool's full parameter schema, whether or not the model will touch it. On 19 November 2026 Google put a preview feature in the Gemini API aimed at that tax. Tool Retrieval lets the model search a tool library and load only the schemas a task needs.[1][3] This guide explains how it works, what Google documents about its cost and limits, and how to decide whether your agent should use it.

We did not run the feature. Everything below is read from Google's announcement, its documentation page and its changelog on 2026-11-20, and the worked numbers are labelled as our own assumptions.

Quick answer

  • What it does: you keep function tools "deferred". The model sees each one's name and description but not its parameter schema, asks for the ones it needs, and the API loads them.[1][2]
  • Where it works: the Interactions API on v1beta only, not generateContent. It is a preview.[2]
  • Models: gemini-4-carbon, gemini-4-neon, gemini-4-hydrogen, gemini-4-argon, gemini-3.8-flash and gemini-3.6-flash are listed.[2]
  • Cost: no separate charge, but each search is an extra model call, and loaded schemas stay billed.[2]
  • What is missing: Google gives no figures for token savings, latency or accuracy gains.[1]

Why large tool sets are a problem

In ordinary tool calling, you declare each function with a name, description and a JSON schema for its parameters, and the model replies with a structured call. The model never runs the function; your code does. The cost is that all declarations are input tokens on every request, and a longer list gives the model more near-duplicates to choose between. Google's stated aim is to cut input tokens and latency and to keep selection accurate as the list grows.[1] The same pressure is why Model Context Protocol servers, which can expose many tools at once, make this feature relevant.

Server-side retrieval: the default mode

Server-side retrieval needs two changes to a request:[2]

  1. Add {"type": "tool_search"} to tools.
  2. Set defer_loading: true on each function tool you want to withhold.

The model then sees each deferred tool's name and description. When it needs one, it asks for it by name; the API loads the full schema and the model emits the function call, all in one API request. The response steps contain a tool_search_call, a tool_search_result and then a function_call, and you execute only the function_call.[2] Google says there is "no index to build or host".[1]

Practical details from the documentation:

  • A compact short_description can be set on a deferred function and is shown during retrieval; it is valid only with defer_loading: true.[2]
  • If you omit it, the first sentence of description is used for the token estimate.[2]
  • Only one tool_search entry is allowed per request.[2]
  • Each retrieval step carries an encrypted signature, which must be passed back unchanged if you manage history yourself.[2]
  • The announcement says loaded schemas are appended later in the conversation instead of at the start, so the cached prefix stays the same across turns.[1]

Client-side retrieval: your own index

If your tools live in a registry you already search, declare tool_search with "execution": "client" plus a name, description and parameters for your own search function. When the model calls it, your code looks up matches and returns function declarations in function_result.result. This takes three turns (search call, your schema response, then the discovered tool call) and adds a round trip per search. The benefit is that tools do not need declaring upfront, so you can expose new ones mid-conversation, for example after a user connects an integration.[1][2]

You cannot combine server-side and client-side retrieval in one request.[2]

Deferring a whole MCP server

Setting defer_loading: true on an mcp_server entry, alongside server-side tool_search, defers every tool that server exposes, so you do not list them individually. The API executes deferred MCP calls remotely and returns mcp_server_tool_call and mcp_server_tool_result steps.[1][2] For teams that attach large MCP servers, this is likely the most useful part: the tool list is whatever the server exposes, not something you curate.

What it costs

The documentation is specific:[2]

  • No separate charge; tokens bill at the model's standard input, cached and output rates.
  • Deferred tools add only their name and short_description (or the first sentence of description) to input tokens.
  • Each server-side search is an extra model call, reported in total_tool_use_tokens and billed at the input rate.
  • Retrieved schemas are appended inline, so implicit caching still applies.
  • Static loading can be cheaper for small tool libraries, or for long contexts that search on every turn.

The changelog adds that each loaded schema is billed as input for the rest of the conversation, as if it had been declared upfront.[3] The announcement advises measuring on your own traffic.[1]

A worked estimate (our assumptions, not Google's numbers)

Suppose an agent has 200 tools whose schemas average 300 tokens each, 60,000 tokens in total, and a typical task uses three of them. Suppose a deferred entry (name plus short description) averages 40 tokens. These are made-up figures for illustration.

ApproachTool tokens per requestAt $3.00 per million input tokens (Gemini 4 Neon standard)
Everything declared upfront60,000$0.180
Deferred, before any search200 x 40 = 8,000$0.024
Deferred, after loading 3 schemas8,000 + 900 = 8,900, plus the search callabout $0.027, plus the search

The Neon input rate is from Google's pricing page.[4] On our assumptions, deferral cuts the tool-token bill by roughly 85% per request. But the first row would cost less if cached: at $0.15 per million for Neon's cached input, a fully cached 60,000-token block is $0.009.[4] That is our reason to treat the saving as workload-dependent. If your tool block is stable and cached, the gap narrows; if your tools change often or you serve many short sessions, it widens. This is why Google's own page says static loading can win for small libraries.[2]

Pitfalls the documentation calls out

Statelessness is where integrations break:[2]

  • Resend tools on every request. Tool declarations are not persisted across turns, including function_result follow-ups.
  • With previous_interaction_id, the API stores prior steps, including search steps.
  • With store=False, append every response step to your history unchanged, in order, with signature fields. Omitting a tool_search_call or stripping a signature returns a 400 error. Omitting a tool_search_result drops the loaded schemas without an error, which is the quieter and worse failure.
  • Do not defer tools named in your system instructions or tool outputs.
  • Always give deferred tools full parameters, or the model cannot call them after retrieval.
  • Check interaction.steps for a function_call on every response, because status is not always requires_action in that case.

Known limitations: Interactions API only; defer_loading applies to server-side retrieval only; the model may issue several searches in one turn; loaded tools stay in context for the rest of the conversation; and a search with no match returns a text response rather than a structured error.[2] The page lists no maximum number of deferred tools, rate limits or quotas.

Naming guidance from the docs is cheap to apply: prefix tool names by service (for example billing_get_customer) and begin each short_description with the service name.[2]

Should you use it?

Our reading of the documentation:

  1. Fewer than a few dozen tools: probably not. The search call and extra state-handling are overhead, and Google says static loading can be cheaper.[2]
  2. Large or MCP-sourced tool sets, many sessions that use only a few tools each: a good candidate. Keep core tools undeferred and defer the long tail.[2]
  3. Tools that appear mid-conversation or per user: client-side mode, accepting the extra round trip.
  4. Anything you cannot afford to break: wait for the feature to leave preview, since the page gives no general availability date.[1]

Run both configurations on the same tasks and record tokens, number of tool calls, wrong-tool selections and pass rate. If you are deciding between models for this kind of agent, our Gemini 4 price comparison covers the four models that support it.

What remains uncertain

Google reports no measurements for token savings, latency or selection accuracy, so any percentage you see should be traced to a test you can reproduce.[1] We did not run the feature, so error behaviour is as documented, not observed. The documentation page carries no date, and as a preview it may change.

Frequently asked questions

What is Tool Retrieval in the Gemini API?
A preview feature of the Interactions API that lets Gemini search a tool library and load only the function schemas it needs, instead of receiving every schema on every request. [2]
Which models support Tool Retrieval?
The documentation lists gemini-4-carbon, gemini-4-neon, gemini-4-hydrogen, gemini-4-argon, gemini-3.8-flash and gemini-3.6-flash. [2]
Does Tool Retrieval cost extra?
No separate charge. Tokens bill at the model's standard rates, each server-side search adds a model call billed at the input rate, and loaded schemas count as input for the rest of the conversation. [2]
Can I use it with remote MCP servers?
Yes. Setting defer_loading to true on an mcp_server entry, alongside server-side tool_search, defers all of that server's tools. [2]

Follow ANTM

The signal, not the noise.

Email signup is paused. Every new story appears in our RSS feed, which works in any feed reader.

Referenced sources

  1. 1.
  2. 2.
  3. 3.
    Gemini API changelog(opens in a new tab)

    GoogleCompanyPublished Nov 19, 2026

  4. 4.
    Gemini API pricing(opens in a new tab)

    GoogleCompanyPublished Nov 20, 2026

ANTM Editorial

Editorial desk

The editorial desk at AI's Next Top Model. Every article cites the documents it is sourced from. See the editorial policy for how we work.