Loading...
    • ビルド
    • 管理
    • モデルと料金
    • クライアントSDK
    • APIリファレンス
    Search...
    ⌘K
    はじめに
    Claudeの概要クイックスタート
    Claudeで構築する
    機能概要Messages APIの使用停止理由の処理
    モデルの機能
    拡張思考適応的思考エフォート高速モード(ベータ:リサーチプレビュー)構造化出力引用ストリーミングメッセージバッチ処理検索結果ストリーミング拒否多言語サポート埋め込み
    ツール
    概要ツール使用の仕組みウェブ検索ツールウェブフェッチツールコード実行ツールメモリツールBashツールコンピューター使用ツールテキストエディタツール
    ツールインフラ
    ツール検索プログラムによるツール呼び出し細粒度ツールストリーミング
    コンテキスト管理
    コンテキストウィンドウコンパクションコンテキスト編集プロンプトキャッシュトークンカウント
    ファイルの操作
    Files APIPDFサポート画像とビジョン
    スキル
    概要クイックスタートベストプラクティスエンタープライズ向けスキルAPIのスキル
    MCP
    リモートMCPサーバーMCPコネクター
    プロンプトエンジニアリング
    概要プロンプトのベストプラクティスConsoleプロンプトツール
    テストと評価
    成功の定義と評価の構築ConsoleでのEvaluation Toolの使用レイテンシの削減
    ガードレールの強化
    幻覚の低減出力の一貫性向上ジェイルブレイクの軽減プロンプトリークの低減
    リソース
    用語集
    リリースノート
    Claude Platform
    Console
    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
    ツール

    Claude でのツール使用

    Claude を外部ツールと API に接続します。ツールが実行される場所とエージェンティックループの仕組みについて学びます。

    ツール使用により、Claude は定義したまたは Anthropic が提供する関数を呼び出すことができます。Claude はユーザーのリクエストとツールの説明に基づいてツールを呼び出すタイミングを決定し、アプリケーションが実行する構造化された呼び出し(クライアントツール)または Anthropic が実行する構造化された呼び出し(サーバーツール)を返します。

    以下は、Anthropic が実行を処理するサーバーツールを使用した最も単純な例です:

    curl https://api.anthropic.com/v1/messages \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" \
      -d '{
        "model": "claude-opus-4-6",
        "max_tokens": 1024,
        "tools": [{"type": "web_search_20260209", "name": "web_search"}],
        "messages": [{"role": "user", "content": "What'\''s the latest on the Mars rover?"}]
      }'

    ツール使用の仕組み

    ツールは主にコードが実行される場所によって異なります。クライアントツール(ユーザー定義ツールと bash や text_editor などの Anthropic スキーマツールを含む)はアプリケーション内で実行されます:Claude は stop_reason: "tool_use" と 1 つ以上の tool_use ブロックで応答し、コードが操作を実行し、tool_result を返します。サーバーツール(web_search、code_execution、web_fetch、tool_search)は Anthropic のインフラストラクチャ上で実行されます:実行を処理することなく結果を直接確認できます。

    エージェンティックループを含む完全な概念モデルと各アプローチを選択するタイミングについては、ツール使用の仕組みを参照してください。

    MCP サーバーへの接続については、MCP コネクタを参照してください。独自の MCP クライアントを構築する場合は、modelcontextprotocol.io を参照してください。

    厳密なツール使用でスキーマ準拠を保証する

    ツール定義に strict: true を追加して、Claude のツール呼び出しが常にスキーマと正確に一致するようにします。厳密なツール使用を参照してください。

    ツール アクセスは、エージェントに与えることができる最も高いレバレッジ プリミティブの 1 つです。LAB-Bench FigQA(科学図の解釈)や SWE-bench(実世界のソフトウェア エンジニアリング)などのベンチマークでは、基本的なツールを追加するだけでも、人間の専門家のベースラインを上回ることが多い、不釣り合いな能力向上が得られます。


    ツール使用の例

    完全なハンズオン チュートリアルについては、チュートリアルを参照してください。個別の概念の参照例については、ツールの定義とツール呼び出しの処理を参照してください。


    価格

    Tool use requests are priced based on:

    1. The total number of input tokens sent to the model (including in the tools parameter)
    2. The number of output tokens generated
    3. For server-side tools, additional usage-based pricing (e.g., web search charges per search performed)

    Client-side tools are priced the same as any other Claude API request, while server-side tools may incur additional charges based on their specific usage.

    The additional tokens from tool use come from:

    • The tools parameter in API requests (tool names, descriptions, and schemas)
    • tool_use content blocks in API requests and responses
    • tool_result content blocks in API requests

    When you use tools, we also automatically include a special system prompt for the model which enables tool use. The number of tool use tokens required for each model are listed below (excluding the additional tokens listed above). Note that the table assumes at least 1 tool is provided. If no tools are provided, then a tool choice of none uses 0 additional system prompt tokens.

    ModelTool choiceTool use system prompt token count
    Claude Opus 4.6auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4.1auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Opus 4auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 4.6auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 4auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Sonnet 3.7 (deprecated)auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Haiku 4.5auto, none
    any, tool
    346 tokens
    313 tokens
    Claude Haiku 3.5auto, none
    any, tool
    264 tokens
    340 tokens
    Claude Opus 3 (deprecated)auto, none
    any, tool
    530 tokens
    281 tokens
    Claude Sonnet 3auto, none
    any, tool
    159 tokens
    235 tokens
    Claude Haiku 3auto, none
    any, tool
    264 tokens
    340 tokens

    These token counts are added to your normal input and output tokens to calculate the total cost of a request.

    現在のモデルごとの価格については、モデル概要表を参照してください。

    ツール使用プロンプトを送信する場合、他の API リクエストと同様に、応答は報告された usage メトリクスの一部として入力トークン数と出力トークン数の両方を出力します。


    次のステップ

    パスを選択する

    概念を理解する

    ツールが実行される場所、ループの仕組み、ツールを使用するタイミング。

    段階的に構築する

    チュートリアル:単一のツール呼び出しから本番環境まで。

    すべてのツールを参照する

    Anthropic 提供ツールとプロパティのディレクトリ。

    Was this page helpful?