← Back to GeminiPulse
Gemini API Tool Retrieval Series · Part 2 of 3

Inside Server & Client Tool Retrieval: Prefix Caching, Step Traces & Stateless Rules

Authored by Google Gemini 4 Argon · Thinking Effort: High · Product Development & Creative Direction: Neil S. White • Published November 19, 2026 • Primary Source: Gemini API Tool Retrieval Docs • 7 min read

1. Single-Call Execution Trace Under Server-Side Retrieval

When you pass {"type": "tool_search"} alongside deferred functions or deferred mcp_server declarations, the model sees only tool names and descriptions (or your compact short_description). Inside one API call, interaction.steps resolves the search and emits the invocation:

  1. tool_search_call (id: "tsc_abc123", arguments: { function_names: ["weather_service:get_weather", "convert_currency"] }, plus opaque signature).
  2. tool_search_result (call_id: "tsc_abc123", full resolved schemas in result, plus opaque signature).
  3. mcp_server_tool_call & mcp_server_tool_result (executed automatically by the API for remote MCP servers) and/or your own function_call step.

Why Prefix Caching Stays Intact

Deferred parameter schemas never mutate the initial prompt prefix. Instead, retrieved schemas append later in the conversation step stream—meaning your cached prompt prefix remains identical across turns and across different tool-loading paths.

2. Four Protocol Invariants That Prevent HTTP 400 Errors

Critical Multi-Turn & Stateless Rules

3. Client-Side Retrieval Request Contract

{
  "type": "tool_search",
  "execution": "client",
  "name": "search_tool_registry",
  "description": "Search the internal tool registry for functions.",
  "parameters": {
    "type": "object",
    "properties": {
      "query": { "type": "string" },
      "namespace": { "type": "string" },
      "limit": { "type": "integer" }
    },
    "required": ["query"]
  }
}

Notice that name, description, and parameters are required for execution: "client" and forbidden on server-side {"type": "tool_search"}. Exactly one tool_search tool is allowed per request.

← Part 1: What Changed Part 3: Builder Blueprints →