Tool use with Claude
by Anthropic
The canonical reference for giving Claude functions it can call.
Overview
This is Anthropic's official 'Tool use with Claude' guide, which explains how Claude calls functions you define (client tools) or that Anthropic runs (server tools such as web_search, web_fetch, code_execution, and tool_search). It walks through how tool use works: you pass tool schemas with an input_schema, Claude responds with stop_reason 'tool_use' and one or more tool_use blocks, your code executes the call and returns a tool_result, and the agentic loop continues. It covers steering tool-calling behavior via the system prompt and tool_choice, guaranteeing schema conformance with strict tool use (strict: true), behavior when required parameters are missing, Anthropic-schema client tools (bash, text_editor, memory, computer use), server tools, the MCP connector, and how tool use affects token pricing, with runnable code samples in cURL, Python, TypeScript, C#, Go, Java, PHP, and Ruby.
At a Glance
- Topic
- Skills
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~25 min read
- Provider
- Anthropic
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓How to define a tool with an input_schema and description so Claude calls it correctly
- ✓The full tool-use loop: tool_use blocks, executing the call, and returning tool_result
- ✓The difference between client tools and Anthropic-run server tools
- ✓How to steer tool-calling with the system prompt and tool_choice (auto/any/tool/none)
- ✓How to enforce exact schema conformance with strict tool use
- ✓How tools affect input/output token counts and pricing
Highlights
- •The authoritative, up-to-date source maintained by Anthropic
- •Runnable examples in eight languages plus cURL
- •Covers both custom tools and built-in server tools (web search, code execution, tool search)
Who It’s For
Best For
- ✓Engineers building tool-using agents on the Claude API
- ✓Developers moving from single prompts to an agentic tool loop
Prerequisites
- •Basic familiarity with the Claude Messages API
- •Comfort reading JSON schemas and making HTTP/SDK calls
FAQ
What is Tool use with Claude?
Anthropic's official documentation on tool use (function calling) with Claude, explaining how to define tools, let Claude decide when to call them, and handle the tool_use / tool_result round trip. For engineers wiring Claude up to external functions and APIs.
Is Tool use with Claude free?
Tool use with Claude is free to access.
What level is Tool use with Claude for?
Tool use with Claude is aimed at a intermediate audience. Recommended background: Basic familiarity with the Claude Messages API, Comfort reading JSON schemas and making HTTP/SDK calls.
How long does Tool use with Claude take?
Expect roughly ~25 min read. Most learners work through it at their own pace.
What will I learn from Tool use with Claude?
You'll learn: How to define a tool with an input_schema and description so Claude calls it correctly; The full tool-use loop: tool_use blocks, executing the call, and returning tool_result; The difference between client tools and Anthropic-run server tools; How to steer tool-calling with the system prompt and tool_choice (auto/any/tool/none); How to enforce exact schema conformance with strict tool use; How tools affect input/output token counts and pricing.