Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env python32"""Tool search (regex) + 6 deferred tools -> server_tool_use, tool_search_tool_result(tool_reference), tool_use. STATUS: LIVE_VERIFIED 2026-09-18 (f1). Use type/name tool_search_tool_bm25_20251119 / tool_search_tool_bm25 for BM25 (f2).3Run: .venv/bin/python examples/anthropic/tools/tool-search/basic.py4"""5import json, sys6from pathlib import Path7sys.path.insert(0, str(Path(__file__).resolve().parents[3]))8from scripts.live import anthropic_request9MODEL = "claude-haiku-4-5-20251001"10st, r, _ = anthropic_request("POST", "/v1/messages", {"model": MODEL, "max_tokens": 300, "tools": [{"type": "tool_search_tool_regex_20251119", "name": "tool_search_tool_regex"}] + [{"name": n, "description": d, "input_schema": {"type": "object", "properties": {"q": {"type": "string"}}, "required": ["q"]}, "defer_loading": True} for n, d in [("get_weather", "Get the current weather for a city"), ("get_stock_price", "Get the latest stock price for a ticker"), ("send_email", "Send an email"), ("create_calendar_event", "Create a calendar event"), ("translate_text", "Translate text"), ("lookup_zip_code", "Look up a US zip code")]], "messages": [{"role": "user", "content": "What is the weather in Paris? Find and call the right tool."}]}, beta=None, note="basic.py")11print("HTTP", st, "stop_reason:", r.get("stop_reason"))12for b in r.get("content", []):13 print(json.dumps({k: v for k, v in b.items() if k in ("type", "name", "toolset_name", "input", "caller", "text", "content", "tool_use_id", "server_name", "is_error")}, ensure_ascii=False)[:600])14print("usage:", json.dumps(r.get("usage")), "container:", r.get("container"))15