講座 › 分野8 ツールとMCP
8.1 ツールの実装
配点 4.4%Tool Implementation
ツールは「どこで動くか」で扱いが変わる。説明を丁寧に書き、少数の考え抜いたツールから始め、失敗は is_error で返す。
未読
ツール使用(関数呼び出し)の基本 読了

ツール使用は、自分で定義した関数や、Anthropicが用意した関数をClaudeに呼ばせる仕組みです。Claudeは、利用者の依頼とツールの説明から、いつ呼ぶかを決め、構造化された呼び出しを返します。ツールは名前、詳しい説明、JSON Schemaの入力の定義で作ります。
出典:Tool use overview
Claude determines when to call a tool based on the user’s request and the tool’s description.https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview…(取得 2026-11-17)
出典:Define tools
A detailed plain text description of what the tool does, when it should be used, and how it behaves.https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-t…(取得 2026-11-17)
クライアント側とサーバー側のツール 読了

ツールの違いは、主にコードがどこで動くかです。クライアント側のツールは自分のアプリで動き、Claudeは stop_reason が tool_use の応答を返します。アプリが実行して tool_result を返します。サーバー側のツール(Web検索など)はAPIの中で実行され、tool_result を返す必要はありません。
出典:Tool use overview
Tools differ primarily by where the code runs.https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview…(取得 2026-11-17)
出典:Server tools
The API runs the tool internally. You see the call and its result in the response, but you don’t handle execution.https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-t…(取得 2026-11-17)
エラー処理と承認のパターン 読了

ツールの実行が失敗したときは、tool_result に is_error: true を付けて返します。人の承認を挟みたい操作は、Agent SDKの権限のルールと canUseTool のコールバックで扱います。拒否のルールに当たった呼び出しは、コールバックを呼ばずに拒否されます。
出典:Handle tool calls
Set to `true` if the tool execution resulted in an error.https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-t…(取得 2026-11-17)
出典:Agent SDK permissions
Use permission modes and rules to define what's allowed automatically, and the `canUseTool` callbackhttps://code.claude.com/docs/en/agent-sdk/permissions.md(取得 2026-11-17)
ツールセットの作り方のベストプラクティス 読了

評価の作業に合った、影響の大きい作業向けの少数の考え抜いたツールから始め、広げていきます。関連する複数の操作は1つのツールにまとめ、名前に接頭辞を付けて役割の境界をはっきりさせます。ツールの応答は、意味のある情報を、トークンを無駄にしない形で返します。厳密さが必要なら strict: true で入力をスキーマどおりにします。
出典:Writing effective tools for agents
We recommend building a few thoughtful tools targeting specific high-impact workflowshttps://www.anthropic.com/research/writing-tools-for-agents(取得 2026-11-17)
出典:Writing effective tools for agents
Tools can consolidate functionality, handling potentially multiple discrete operations (or API calls) under the hood.https://www.anthropic.com/research/writing-tools-for-agents(取得 2026-11-17)
出典:Writing effective tools for agents
Namespacing tools to define clear boundaries in functionalityhttps://www.anthropic.com/research/writing-tools-for-agents(取得 2026-11-17)
試験のポイント
- クライアント側は tool_result を返す、サーバー側は返さない。
出典:Server tools
Unlike client `tool_use` blocks, you don’t need to respond with a `tool_result`.
https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-t…(取得 2026-11-17) - APIを1対1で包んだツールを大量に作るより、作業単位の少数のツール。
出典:Writing effective tools for agents
which match your evaluation tasks and scaling up from there
https://www.anthropic.com/research/writing-tools-for-agents(取得 2026-11-17)