一行要約

ツール定義だけで会話開始前に 55K〜134K トークンが消える問題に対する3つの機能 — Tool Search Tool(85%削減)、Programmatic Tool Calling(37%削減)、Tool Use Examples(精度 72% → 90%)。

要点

問題の規模

  • MCP サーバ5台分のツール定義で、会話が始まる前に約 55K トークンを消費する
  • 社内テストでは、最適化前にツール定義だけで 55K〜134K トークンが消えていた

The future of AI agents is one where models work seamlessly across hundreds or thousands of tools. AI エージェントの未来は、モデルが数百から数千のツールをまたいで滞りなく働く姿である。

3つの機能と効果

1. Tool Search Tool — 全定義を先読みせず、必要になったときに動的に発見させる

指標効果
context 消費約 72K → 約 8.7K トークン(85%削減)
残る context122,800 → 191,300 トークン
Opus 4 の精度49% → 74%
Opus 4.5 の精度79.5% → 88.1%

Agents should discover and load tools on-demand, keeping only what’s relevant for the current task. エージェントはツールを必要に応じて発見してロードし、いまのタスクに関係するものだけを保持すべきである。

2. Programmatic Tool Calling — サンドボックスでのコード実行を通じてツールを呼び、中間結果を context の外で処理する

指標効果
トークン消費43,588 → 27,297(37%削減)
社内の知識検索25.6% → 28.5%
GIA ベンチマーク46.5% → 51.2%

複数回の推論パスそのものを不要にする点が、単なるトークン削減以上の効果を生む。

3. Tool Use Examples — ツール定義に呼び出しのサンプルを添える。JSON Schema では表現できないパラメータ間の相関や慣習を伝えられる。

指標効果
複雑なパラメータ処理の精度72% → 90%

These features move tool use from simple function calling toward intelligent orchestration. これらの機能は、ツール利用を単純な関数呼び出しから知的なオーケストレーションへと進める。

そのまま使える具体例

Tool Search Tool を有効にし、個別ツールを遅延ロードにする:

{
  "tools": [
    {"type": "tool_search_tool_regex_20251119", "name": "tool_search_tool_regex"},
    {
      "name": "github.createPullRequest",
      "description": "Create a pull request",
      "input_schema": {},
      "defer_loading": true
    }
  ]
}

MCP サーバ単位で遅延ロードを設定し、よく使うツールだけ例外にする:

{
  "type": "mcp_toolset",
  "mcp_server_name": "google-drive",
  "default_config": {"defer_loading": true},
  "configs": {
    "search_files": {
      "defer_loading": false
    }
  }
}

ツールを programmatic calling の対象にする(allowed_callers が鍵):

{
  "tools": [
    {
      "type": "code_execution_20250825",
      "name": "code_execution"
    },
    {
      "name": "get_team_members",
      "description": "Get all members of a department...",
      "input_schema": {},
      "allowed_callers": ["code_execution_20250825"]
    }
  ]
}

Claude が書くオーケストレーションコードの例(中間結果が context を通らない):

team = await get_team_members("engineering")
 
# Fetch budgets for each unique level
levels = list(set(m["level"] for m in team))
budget_results = await asyncio.gather(*[
    get_budget_by_level(level) for level in levels
])
 
# Create a lookup dictionary: {"junior": budget1, "senior": budget2, ...}
budgets = {level: budget for level, budget in zip(levels, budget_results)}
 
# Fetch all expenses in parallel
expenses = await asyncio.gather(*[
    get_expenses(m["id"], "Q3") for m in team
])
 
# Find employees who exceeded their travel budget
exceeded = []
for member, exp in zip(team, expenses):
    budget = budgets[member["level"]]
    total = sum(e["amount"] for e in exp)
    if total > budget["travel_limit"]:
        exceeded.append({
            "name": member["name"],
            "spent": total,
            "limit": budget["travel_limit"]
        })
 
print(json.dumps(exceeded))

Tool Use Examples(フル装備 → 中間 → 最小、の3段階を見せるのが巧い):

{
    "name": "create_ticket",
    "input_schema": {},
    "input_examples": [
      {
        "title": "Login page returns 500 error",
        "priority": "critical",
        "labels": ["bug", "authentication", "production"],
        "reporter": {
          "id": "USR-12345",
          "name": "Jane Smith",
          "contact": {
            "email": "jane@acme.com",
            "phone": "+1-555-0123"
          }
        },
        "due_date": "2024-11-06",
        "escalation": {
          "level": 2,
          "notify_manager": true,
          "sla_hours": 4
        }
      },
      {
        "title": "Add dark mode support",
        "labels": ["feature-request", "ui"],
        "reporter": {
          "id": "USR-67890",
          "name": "Alex Chen"
        }
      },
      {
        "title": "Update API documentation"
      }
    ]
}

有効化:

client.beta.messages.create(
    betas=["advanced-tool-use-2025-11-20"],
    model="claude-sonnet-4-5-20250929",
    max_tokens=4096,
    tools=[
        {"type": "tool_search_tool_regex_20251119", "name": "tool_search_tool_regex"},
        {"type": "code_execution_20250825", "name": "code_execution"},
        # Your tools with defer_loading, allowed_callers, and input_examples
    ]
)

原典で言及されている関連文書

未取得の派生リンク