Claude Tool Use (also called function calling) is a capability Anthropic provides for Claude to connect to external tools and APIs. Developers can define functions or use tools provided by Anthropic, and Claude determines when to call them based on the user's request and the tool description, then returns structured call results.
Purpose and Execution Location Tools are primarily distinguished by where the code runs. Client tools (including user-defined tools and tools with Anthropic-defined schemas such as bash and text_editor) run in the developer's application: Claude returns stop_reason: "tool_use" and one or more tool_use blocks, and the application performs the operation and sends back tool_result. Server tools (such as web_search, web_fetch, code_execution, and tool_search) run on Anthropic infrastructure, and developers receive results directly without handling execution; however, if Claude places them in the same group of parallel calls as client tools, refer to the stop reasons and fallback mechanisms.
Key Capabilities
- Custom tools: pass in tool definitions with input_schema; after Claude returns tool_use blocks, the application executes them and sends back the results.
- Strict schema validation: add strict: true to custom tool definitions to ensure tool calls strictly match the schema.
- Tool choice control: the default tool_choice is {"type": "auto"}, and Claude decides each turn whether to call a tool; you can also force a call via tool_choice, or adjust the tendency to call tools via the system prompt.
- Parallel tool calls: supports calling multiple tools in a single response.
- Server tools: include web search (with cited sources), fetching the full text of web pages and PDFs, running Python and Bash code in a sandboxed container, letting the executing model consult a higher-intelligence advisor model during generation, discovering and loading large numbers of tools on demand, and connecting to remote MCP servers via the Messages API.
- Tool runner: the SDK can automatically run tools and send back results, eliminating the need to hand-write the round-trip flow.
- MCP connector: can connect to Model Context Protocol server, or you can build an MCP client yourself according to the guide.
Usage The minimal server-side tool example is Web search: Claude performs the search on Anthropic infrastructure and returns the results with citations in the same response. When using custom client tools, you need to pass a tool definition with input_schema, run the invocation after Claude returns a tool_use block, and then return the results in a tool_result block. Handling tool calls requires parsing the tool_use block, formatting the tool_result, and handling errors.
Invocation timing and limitations In the default automatic mode, when the request corresponds to a capability described by a tool and the answer is not in the context, Claude will call the tool; for stable knowledge, creative tasks, and conversational turns, it answers directly. Tool usage can be adjusted via the system prompt, for example, "Use the tools to investigate before responding." increases tool usage, "Always call a tool first before responding." further strengthens it, while "Use your judgment about whether to call a tool or respond directly." remains conservative. If the user prompt lacks required parameters, Claude Opus is more likely to recognize the missing information and ask a follow-up question, while Claude Sonnet may ask a follow-up question or may infer a reasonable value; this behavior is not guaranteed, especially when the prompt is ambiguous or the model's capabilities are weaker.
Billing Tool-use requests are billed by the total number of input tokens sent to the model (including the tools parameter) and the number of output tokens. Server-side tools may incur additional usage-based charges; for example, web search is charged per search. Client tools are billed the same as regular Claude API requests. The additional tokens brought by tool use come from the tools parameter in the API request (tool names, descriptions, and schema), the tool_use content blocks in the request and response, and the tool_result content blocks in the request. When using tools, the API also automatically adds a special system prompt that enables tool use; the number of tool-use tokens required varies by model; when no tools are provided and tool_choice is none, that system prompt is 0 tokens.具Check the All models table for specific unit prices.