What is Tool use?
The mechanism by which an LLM invokes external functions — shell commands, HTTP calls, file edits — described to it in a structured schema. Every modern agent platform is built on tool use.
How a tool call works
In the Claude API, tool use (also called function calling) lets the model call functions you define or that Anthropic provides. You describe each tool with a name, a description and a JSON input schema. The model decides, from the request and the descriptions, whether to call one, and returns a structured call instead of prose.
Who runs the tool
It depends on the tool. With client tools (including the ones you define), the response stops with stop_reason "tool_use" and one or more tool_use blocks; your own code runs the operation and sends back a tool_result block. Server tools such as web search, web fetch and code execution run on Anthropic's infrastructure and the results come back in the same response.
What it costs
Tool definitions, tool_use blocks and tool_result blocks all count as input or output tokens, and the API adds a short built-in system prompt when tools are present. Server tools can add usage-based charges on top, such as a per-search fee for web search.
Example
You define a get_weather tool that takes a location. The user asks about San Francisco; the model replies with a tool_use block naming get_weather and the location. Your code looks up the weather and returns it in a tool_result block, and the model writes the final answer from that result.
Sources
See also
← Back to the full AI agent glossary.