---
title: 工具參考
url: https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference
description: Anthropic 提供的伺服器工具、用戶端工具與用戶端工具集目錄，以及選用工具定義屬性的參考說明。
---

本頁是 Anthropic 所提供工具的參考，以及您可以在任何工具定義上設定的選用屬性。如需「tool use」（工具使用）的概念性介紹，請參閱 [Claude 的工具使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/overview)。如需在您的應用程式中實作工具使用的指引，請參閱[定義工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/define-tools)。

## Anthropic 提供的工具

Anthropic 提供兩種工具：在 Anthropic 基礎設施上執行的**伺服器工具**（server tools），以及由 Anthropic 定義結構描述（schema）但由您的應用程式負責執行的**用戶端工具**（client tools）。這兩種工具都會與任何使用者自訂工具一同出現在您請求的 `tools` 陣列中。

| 工具                                                                                              | `type`                                                                                             | 執行方式 | [Beta 標頭](https://platform.claude.com/docs/zh-TW/api/beta-headers) |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------ |
| [網頁搜尋工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/web-search-tool)      | `web_search_20260318`<br />`web_search_20260209`<br />`web_search_20250305`                        | 伺服器  | 無                                                                  |
| [網頁擷取工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/web-fetch-tool)       | `web_fetch_20260318`<br />`web_fetch_20260309`<br />`web_fetch_20260209`<br />`web_fetch_20250910` | 伺服器  | 無                                                                  |
| [程式碼執行工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/code-execution-tool) | `code_execution_20260521`<br />`code_execution_20260120`<br />`code_execution_20250825`            | 伺服器  | 無                                                                  |
| [顧問工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/advisor-tool)           | `advisor_20260301`                                                                                 | 伺服器  | `advisor-tool-2026-03-01`                                          |
| [工具搜尋工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-search-tool)     | `tool_search_tool_regex_20251119`<br />`tool_search_tool_bm25_20251119`                            | 伺服器  | 無                                                                  |
| [MCP 連接器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-connector)                | `mcp_toolset`                                                                                      | 伺服器  | `mcp-client-2025-11-20`                                            |
| [記憶工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/memory-tool)            | `memory_20250818`                                                                                  | 用戶端  | 無                                                                  |
| [Bash 工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/bash-tool)           | `bash_20250124`                                                                                    | 用戶端  | 無                                                                  |
| [文字編輯器工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/text-editor-tool)    | `text_editor_20250728`<br />`text_editor_20250124`                                                 | 用戶端  | 無                                                                  |
| [電腦使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool)    | `computer_toolset_20260801`<br />`computer_20251124`<br />`computer_20250124`                      | 用戶端  | 無<br />`computer-use-2025-11-24`<br />`computer-use-2025-01-24`    |
| [瀏覽器使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool)    | `browser_toolset_20260801`                                                                         | 用戶端  | 無                                                                  |

關於模型相容性，請參閱各工具的頁面。支援的模型因工具及工具版本而異。若要從您的程式碼檢查某個模型是否接受網頁搜尋或程式碼執行，請參閱[使用 Models API](https://platform.claude.com/docs/zh-TW/models/overview#using-the-models-api)。

<Note>
  工具搜尋的 `type` 值也接受不含日期的別名： `tool_search_tool_regex` 與 `tool_search_tool_bm25`。這些別名會解析為 最新的含日期版本。
</Note>

### 工具版本管理

大多數 Anthropic 提供的工具在 `type` 字串中帶有 `_YYYYMMDD` 後綴。當工具的行為、結構描述或模型支援有所變更時，便會發布新版本。舊版本仍可繼續使用，以確保既有的整合能持續運作。

當某個工具有多個有效版本時，它們之間的關係各有不同：

* **依功能區分：** `web_search_20260209` 和 `web_fetch_20260209` 相較於前一版本新增了動態內容篩選；`web_fetch_20260309` 新增了略過快取的選項；`web_search_20260318` 和 `web_fetch_20260318` 新增了回應內容納入控制。`code_execution_20260120` 新增了從沙箱內進行[程式化工具呼叫](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/programmatic-tool-calling)的功能；`code_execution_20260521` 則在工具描述中揭露每個儲存格的時間限制。在上述每種情況下，新舊版本都是現行版本；要使用哪一個，取決於您是否需要新功能。
* **依模型區分：** `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 和檔案操作。
* **後繼版本：** `computer_toolset_20260801` 是 beta 版 `computer_20251124` 和 `computer_20250124` 的穩定後繼版本；這些舊版本在[較早的工具版本](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#earlier-tool-versions)中所列的模型上仍可使用。`browser_toolset_20260801` 是瀏覽器使用工具的第一個版本。兩者皆為[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)。

`mcp_toolset` 類型不以日期進行版本管理；其版本資訊改由 `anthropic-beta` 標頭承載。

### 用戶端工具集

[電腦使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool)與[瀏覽器使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool)是 Anthropic 定義的「client toolsets」（用戶端工具集）：`tools` 中的一個項目會宣告一組固定的成員工具，其名稱、描述與輸入結構描述由 Anthropic 定義，而每次呼叫皆由您的應用程式執行。該項目不接受 `name`，因為含日期的 `type` 已固定了成員名稱。`configs`、`cache_control` 與 `allowed_callers`（僅接受 `["direct"]`）為選用。

用戶端工具集是 Messages API 工具。它們目前無法作為 [Claude Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/tools) 中的代理工具使用，後者提供其自有的內建代理工具集、MCP 工具集與自訂工具。

```json
{
  "type": "browser_toolset_20260801",
  "configs": {
    "javascript_exec": { "enabled": true }
  },
  "cache_control": { "type": "ephemeral" }
}
```

`configs` 用於調整個別成員：

* 鍵為成員名稱，每個值僅接受 `enabled` 與 `defer_loading`。
* 您省略的成員會保留其預設值。缺少值、`{}` 與重述預設值三者等效。
* 未知的成員名稱或成員值中的任何其他欄位都會被拒絕，停用所有成員的 `configs` 亦然（請改為省略該項目）。
* 被停用的成員會從 Claude 可見的工具中移除。若 Claude 仍然指名該成員，請回傳錯誤的 `tool_result`。

請針對每個成員設定 `defer_loading`，切勿設定在項目上，並為每個已啟用的成員指定相同的值：在[工具搜尋](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-search-tool#deferred-tool-loading)下，工具集會作為單一定義載入並展開。當每個已啟用的成員都延遲載入時，只有本身未延遲載入的[工具搜尋工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-search-tool)才能讓該工具集浮現，因此請在同一請求中宣告一個。請勿在成員延遲載入的工具集項目上放置 `cache_control`；請改為將斷點設定在非延遲載入的工具上，因為延遲載入的定義不屬於快取前綴的一部分。

`cache_control` 僅能放在項目上；若要了解斷點落在何處（包括批次動作內的標記），請參閱[搭配提示快取的工具使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-use-with-prompt-caching#cache-control-on-tool-definitions)。

**處理成員工具呼叫。** Claude 會以 `tool_use` 區塊呼叫成員，其 `name` 為成員名稱，`toolset_name` 為 `computer` 或 `browser`；`input` 包含該成員的參數，且沒有 `action` 欄位。請依據 `toolset_name` 與 `name` 的組合進行分派，因為自訂工具可能與某個成員同名，且兩個工具集共用如 `screenshot` 等名稱。只有成員結果會回傳 `toolset_name`。同一輪中的多個成員呼叫會構成一個批次動作，您需依序執行（[電腦使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#batch-actions)、[瀏覽器使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#batch-actions)）。新成員只會隨新的含日期 `type` 一同推出。

**工具集項目不支援的項目。** API 會以 `invalid_request_error` 拒絕以下每一項：

* `strict: true` 或 `input_examples`。
* 項目上的 `defer_loading`，或已啟用成員的 `defer_loading` 值不一致（請在 `configs` 中針對每個成員設定，且全部設為相同的值）。
* `allowed_callers` 中的程式碼執行呼叫者（不支援[程式化工具呼叫](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/programmatic-tool-calling)）。
* 舊版的 `fine-grained-tool-streaming-2025-05-14` beta 標頭。當您進行串流時，每個成員的 `input` 會以一個完整的 `input_json_delta` 送達。
* 類型為 `tool` 且指名工具集或成員的 `tool_choice`（請使用 `auto`、`any` 或 `none`）。
* 同一工具集的兩個項目，或帶有該工具集名稱的其他工具：與 `computer_toolset_20260801` 並存且名為 `computer` 的工具，或與 `browser_toolset_20260801` 並存且名為 `browser` 的工具。這兩個工具集可以一同宣告。

## 工具定義屬性

`tools` 陣列中的每個工具（包括使用者自訂工具）都接受選用屬性，用以控制工具的載入方式、誰可以呼叫它，以及其輸入的驗證方式。這些屬性可以組合使用：您可以在同一個工具上同時設定 `defer_loading`、`cache_control` 與 `strict`。

| 屬性                      | 用途                                               | 適用於                                                                                                                                                                                                                                                                                    | 詳細指南                                                                                                                            |
| ----------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `cache_control`         | 在此工具定義處設定提示快取斷點                                  | 所有工具（在 `computer_toolset_20260801` 與 `browser_toolset_20260801` 上，請設定在工具集項目本身，而非成員 `configs` 內）                                                                                                                                                                                        | [提示快取](https://platform.claude.com/docs/zh-TW/build-with-claude/prompt-caching)                                                 |
| `strict`                | 保證對工具名稱與輸入進行結構描述驗證                               | 除 `mcp_toolset`、`computer_toolset_20260801` 與 `browser_toolset_20260801` 以外的所有工具                                                                                                                                                                                                       | [嚴格工具使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/strict-tool-use)                                      |
| `defer_loading`         | 將工具排除於初始系統提示之外；當工具搜尋為其回傳 `tool_reference` 時再按需載入 | 所有工具（關於 `mcp_toolset`，請參閱[工具設定](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-connector#mcp-toolset-configuration)）。在電腦使用與瀏覽器使用工具集上，請在 `configs` 內針對每個成員設定；請參閱[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)。 | [工具搜尋工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-search-tool)                                     |
| `allowed_callers`       | 限制哪些呼叫者可以呼叫該工具                                   | 除 `mcp_toolset` 以外的所有工具（在 `computer_toolset_20260801` 與 `browser_toolset_20260801` 上，僅接受 `["direct"]`；請參閱[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)）                                                                    | [程式化工具呼叫](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/programmatic-tool-calling#the-allowed-callers-field) |
| `input_examples`        | 提供範例輸入物件，協助 Claude 理解如何呼叫該工具                     | 使用者自訂工具與 Anthropic 結構描述的用戶端工具，`computer_toolset_20260801` 與 `browser_toolset_20260801` 除外。不適用於伺服器工具。                                                                                                                                                                                   | [定義工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/define-tools#providing-tool-use-examples)               |
| `eager_input_streaming` | 為此工具啟用細粒度輸入串流（`true`）或維持標準緩衝串流（`false`）          | 僅限使用者自訂工具                                                                                                                                                                                                                                                                              | [細粒度工具串流](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/fine-grained-tool-streaming)                         |

### `allowed_callers` 值

`allowed_callers` 是一個陣列，接受以下任意組合：

| 值                           | 意義                                                       |
| --------------------------- | -------------------------------------------------------- |
| `"direct"`                  | 模型可以在 `tool_use` 區塊中直接呼叫此工具。若省略 `allowed_callers`，此為預設值。 |
| `"code_execution_20260120"` | 在 `code_execution_20260120` 或更新版本沙箱內執行的程式碼可以呼叫此工具。       |

`"code_execution_20260120"` 與 `"code_execution_20260521"` 在 `allowed_callers` 中皆可接受且可互換：使用任一程式碼執行工具版本的請求，都能滿足列出任一呼叫者的工具。無論請求宣告的是哪個版本，回應區塊一律將呼叫者標記為 `code_execution_20260120`。

從陣列中省略 `"direct"`（例如 `"allowed_callers": ["code_execution_20260120"]`）會引導 Claude 僅從程式碼執行內部呼叫該工具。回應的 `tool_use` 區塊包含一個 `caller` 欄位，用以識別是哪個呼叫者呼叫了該工具。完整說明（包括 `caller` 回應格式與錯誤行為）請參閱[程式化工具呼叫](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/programmatic-tool-calling#the-allowed-callers-field)。

### `defer_loading` 與提示快取

設有 `defer_loading: true` 的工具會在計算快取鍵之前，從已轉譯的工具區段中移除。它們完全不會出現在系統提示前綴中。當工具搜尋發現某個延遲載入的工具並為其回傳 `tool_reference` 時，該工具的完整定義會在對話主體中的該位置就地展開，而非在前綴中。

這表示 `defer_loading: true` 能保留您的提示快取。您可以在請求中加入延遲載入的工具而不會使既有的快取項目失效，且快取在工具被發現的那一輪與工具被呼叫的那一輪之間皆維持有效。

若要了解如何將 `defer_loading` 與 `cache_control` 斷點結合使用，請參閱[工具搜尋工具的提示快取指引](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-search-tool#prompt-caching)。
