Loading...
  • 构建
  • 管理
  • 模型与定价
  • 客户端 SDK
  • API 参考
Search...
⌘K
Log in
工具参考
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
构建/工具基础设施

工具参考

Anthropic 提供的工具目录和可选工具定义属性的参考。

本页面是 Anthropic 提供的工具和可在任何工具定义上设置的可选属性的参考。有关工具使用的概念介绍,请参阅 Claude 的工具使用。有关在应用程序中实现工具使用的指导,请参阅 定义工具。

Anthropic 提供的工具

Anthropic 提供两种工具:在 Anthropic 基础设施上执行的服务器工具,以及 Anthropic 定义架构但由应用程序处理执行的客户端工具。两种工具都与任何用户定义的工具一起出现在请求的 tools 数组中。

工具type执行位置状态
Web 搜索工具web_search_20260209
web_search_20250305
服务器GA
Web 获取工具web_fetch_20260209
web_fetch_20250910
服务器GA
代码执行工具code_execution_20260120
code_execution_20250825
服务器GA
Advisor 工具advisor_20260301服务器Beta: advisor-tool-2026-03-01
工具搜索工具tool_search_tool_regex_20251119
tool_search_tool_bm25_20251119
服务器GA
MCP 连接器mcp_toolset服务器Beta: mcp-client-2025-11-20
Memory 工具memory_20250818客户端GA
Bash 工具bash_20250124客户端GA
文本编辑器工具text_editor_20250728
text_editor_20250124
客户端GA
计算机使用工具computer_20251124
computer_20250124
客户端Beta: computer-use-2025-11-24
computer-use-2025-01-24

有关模型兼容性,请参阅每个工具的页面。支持的模型因工具和工具版本而异。

工具搜索 type 值也接受未标注日期的别名: tool_search_tool_regex 和 tool_search_tool_bm25。这些会解析为 最新的带日期版本。

工具版本控制

大多数 Anthropic 提供的工具在 type 字符串中带有 _YYYYMMDD 后缀。当工具的行为、架构或模型支持发生变化时,会发布新版本。较旧的版本仍然可用,以便现有集成继续工作。

当工具有多个活跃版本时,它们之间的关系各不相同:

  • 功能键控: web_search_20260209 和 web_fetch_20260209 在其前身基础上添加了动态内容过滤。code_execution_20260120 添加了程序化工具调用功能,可在沙箱内使用。在每种情况下,新版本和旧版本都是当前版本;使用哪一个取决于是否需要新功能。
  • 模型键控: text_editor_20250728 用于 Claude 4 模型,text_editor_20250124 用于早期模型。使用的版本取决于目标模型。
  • 变体,而非版本: tool_search_tool_regex_20251119 和 tool_search_tool_bm25_20251119 是一起发布的两种搜索算法。两者都不会取代另一个。
  • 遗留版本: code_execution_20250522 仅支持 Python。code_execution_20250825 添加了 Bash 和文件操作。

mcp_toolset 类型不是日期版本化的;版本控制在 anthropic-beta 标头中进行。

工具定义属性

tools 数组中的每个工具(包括用户定义的工具)都接受可选属性,这些属性控制工具的加载方式、谁可以调用它以及如何验证其输入。这些属性是可组合的:可以在同一工具上设置 defer_loading 和 cache_control 和 strict。

属性目的可用于详细指南
cache_control在此工具定义处设置提示缓存断点所有工具提示缓存
strict保证工具名称和输入的架构验证除 mcp_toolset 外的所有工具严格工具使用
defer_loading从初始系统提示中排除工具;当工具搜索为其返回 tool_reference 时按需加载所有工具(对于 mcp_toolset,请参阅工具配置)工具搜索工具
allowed_callers限制哪些调用者可以调用该工具除 mcp_toolset 外的所有工具程序化工具调用
input_examples提供示例输入对象以帮助 Claude 理解如何调用该工具用户定义和 Anthropic 架构客户端工具。在服务器工具上不可用。定义工具
eager_input_streaming为此工具启用细粒度输入流 (true) 或保持标准缓冲流 (false)仅用户定义的工具细粒度工具流

allowed_callers 值

allowed_callers 是一个数组,接受以下任何组合:

值含义
"direct"模型可以在 tool_use 块中直接调用此工具。如果省略 allowed_callers,这是默认值。
"code_execution_20260120"在 code_execution_20260120 沙箱内运行的代码可以调用此工具。

从数组中省略 "direct"(例如,"allowed_callers": ["code_execution_20260120"])意味着该工具只能从代码执行内调用。响应的 tool_use 块包含一个 caller 字段,用于标识哪个调用者调用了该工具。有关完整处理(包括 caller 响应形状和错误行为),请参阅程序化工具调用。

defer_loading 和提示缓存

具有 defer_loading: true 的工具在计算缓存键之前会从呈现的工具部分中删除。它们根本不会出现在系统提示前缀中。当工具搜索发现延迟工具并为其返回 tool_reference 时,工具的完整定义会在对话正文中的该点内联展开,而不是在前缀中。

这意味着 defer_loading: true 会保留您的提示缓存。可以将延迟工具添加到请求中而不会使现有缓存条目失效,并且缓存在发现工具的轮次和调用工具的轮次之间保持有效。

有关如何将 defer_loading 与 cache_control 断点结合使用,请参阅工具搜索工具提示缓存指南。

Was this page helpful?

  • Anthropic 提供的工具
  • allowed_callers 值
  • defer_loading 和提示缓存