Home › Claude Ecosystem Guides
Claude Tool Use: How Claude Calls Functions
Tool use, or function calling, is the mechanism that lets Claude request actions your code executes — the single loop that turns a text model into an agent.
What tool use actually is
Tool use — also called function calling — is how a language model reaches beyond text and acts on the world. On its own, Claude only produces words; it cannot query a database, hit an API, or read a file. Tool use closes that gap. You describe the functions Claude is allowed to call, and when a request needs one, the model asks you to run it and hands back the arguments.
The key mental shift is that Claude never executes anything itself. It decides which tool fits and what inputs to pass; your own code does the running. That separation keeps you in control of side effects, credentials, and safety while letting the model handle the reasoning about when a capability is actually needed.
Defining tools and the request loop
Each tool is declared with a name, a short description, and a JSON-schema definition of its input. The description matters more than developers expect: it is the only thing Claude reads to decide when a tool applies, so write it like documentation, not a label.
The exchange is a loop. You send the user message plus the tool definitions. Claude replies with one or more tool_use blocks, each naming a tool and a structured input. Your code executes the real work and sends the outcome back as tool_result blocks that reference the matching request. Claude reads those results and either answers the user or asks for another tool. The cycle repeats until the task is done.
- You define: name, description, input schema.
- Claude returns: tool_use blocks with arguments.
- You return: tool_result blocks with the output.
Knowing when to stop: stop_reason
Every response carries a stop_reason that tells your loop what to do next. When Claude wants a tool, the reason signals a pending tool call and your code must run it and reply. When Claude is finished, the reason becomes end_turn — that is your cue to stop looping and show the final answer.
Building the loop around stop_reason rather than guessing keeps control flow honest: you never run a tool the model did not request, and you never cut a multi-step task short. A weather assistant, for example, might call a geocoding tool, read the result, call a forecast tool, and only then reach end_turn with a written answer.
Running several tools in parallel
A single response can contain several tool_use blocks at once. When Claude sees that three independent lookups are all needed, it can request them together instead of one per round trip. Your code runs them — often concurrently — and returns all the matching tool_result blocks in the next message.
This matters for latency. Fetching a customer record, their recent orders, and their support tickets in parallel collapses three sequential loops into one, which is the difference between a snappy agent and a sluggish one. The model still waits for every result before it reasons about the combined picture.
Why this loop is the foundation of every agent
Everything more advanced is tool use with more scaffolding around the same loop. MCP standardizes how tools are exposed so any client can reuse them; an agent SDK packages the loop with built-in tools and permissions; extended thinking adds a reasoning pass before the model plans its calls. Strip those away and the core is unchanged: define tools, receive requests, return results, repeat.
Because of that, understanding this loop cleanly is the highest-leverage thing you can learn in the Claude ecosystem. Master it here and every heavier abstraction becomes a convenience rather than a mystery — which is exactly what the interactive course builds on next.
Frequently asked
- Is tool use the same as function calling?
- Yes. They are two names for the same mechanism: you describe functions the model may call, and it returns structured requests for your code to execute.
- Does Claude execute the tools itself?
- No. Claude only decides which tool to call and with what arguments; your own code runs the tool and returns the result as a tool_result block. Server-side tools like web search are the exception, running on Anthropic's infrastructure.
- How does Claude know when to stop calling tools?
- Each response includes a stop_reason. Your loop keeps running tools while Claude requests them and stops once the reason becomes end_turn, which signals the final answer.
Work through it interactively
Every area has questions, spaced-repetition cards and a progress record. Those need an account, which is free and takes a moment.
Open the interactive track Create a free account