1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Tool Use with Claude

Implement tool use with Claude API: define tools, handle tool calls, and build reliable function-calling agents.

Last updated

Core9 min readFirst readMessages APIInside a Tool Call

After this section you can

  • Choose a tool_choice setting, and replace forced tool use on models that reject it
  • Guarantee schema-valid arguments with strict tools and say what still needs checking
  • Handle parallel calls, server tools and pause_turn, and decide between the Tool Runner and a manual loop
21

Tool Use: Giving Claude Superpowers

You already know the four-piece relay. This section is the Claude-specific control panel: who decides whether a tool runs, how to guarantee valid arguments, parallel calls, tools Anthropic runs for you, and letting the SDK drive the loop.

Key idea

The relay never changes; the settings around it do. tool_choice decides who picks, strict guarantees the arguments, one user message carries every result, and server tools skip the relay entirely because Anthropic runs them.

Two kinds of tool: yours run in your code, Anthropic’s run inside the API call
CLIENT TOOL · YOU EXECUTE · TWO REQUESTS request 1 tools: [get_orders] response tool_use · stops your code runs get_orders() request 2 → answer + tool_result SERVER TOOL · ANTHROPIC EXECUTES · ONE REQUEST request tools: [web_search] inside the API: search → read results → search again you write no execution code one response results + final text Same model, same tools list. What changes is who runs the tool and how many requests it takes.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium