> ## Content Index
> Fetch the complete content index at: https://globalfeed.ai/llms.txt
> Use this file to discover other available public pages before exploring further.

# Gemini API 工具检索：智能体如何按需加载工具？
- URL: https://globalfeed.ai/zh/gemini-api-gong-ju-jian-suo-zhi-neng-ti-ru-he-an-xu-jia-zai-gong-ju/
- Published: 2026-11-21T20:07:51.000Z
- Updated: 2026-11-21T20:07:51.000Z
- Description: Google 在 Gemini API 推出 Tool Retrieval 预览版，只在需要时加载工具定义。用法、模式与价格。
- Author: GlobalFeed Editor
- Tags: Gemini, Google, 智能体, dil-zh, elle

Google 于11月19日在 Gemini API 中推出 Tool Retrieval（工具检索）预览版，目前仅支持 Interactions API。智能体可以保留完整的工具库，但只在需要时加载具体的参数定义。据 Google [开发者指南](https://ai.google.dev/gemini-api/docs/tool-retrieval?ref=globalfeed.ai)，几十个函数定义每次请求就可能占用数万 token，候选越多，选错工具的概率也越高。

## 如何使用

只需在工具列表中加入 `{"type": "tool_search"}`，并给要延后加载的工具设置 `"defer_loading": true`。模型只看到这些工具的名称和描述，需要时按名称请求，API 加载完整定义后模型即可调用，三步都在同一次请求内完成。如果使用自己的工具注册表，可设置 `"execution": "client"` 由应用自行检索；远程 MCP 服务器也支持整体延后加载。

## 价格与限制

据 Google [公告](https://blog.google/innovation-and-ai/technology/developers-tools/gemini-api-tool-retrieval/?ref=globalfeed.ai)，该功能不单独收费，按模型标准价格计费；每次请求只能有一个 tool\_search，工具列表需每轮重新发送。适用于 Gemini 3.6 及之后的模型，包括全部 Gemini 4 模型。

来源： [Google 公告](https://blog.google/innovation-and-ai/technology/developers-tools/gemini-api-tool-retrieval/?ref=globalfeed.ai), [Gemini API 指南](https://ai.google.dev/gemini-api/docs/tool-retrieval?ref=globalfeed.ai)