Tool Use Overview
What function calling is, why you'd extend Claude with tools, and how the 4-step tool use cycle works end to end.
What Is Tool Use?
Tool use (function calling) lets you extend Claude's capabilities with external functions. You define tools, Claude decides when to call them, you execute the code, and return the result.
Key insight: Claude never runs code itself. It asks you to call a function, and you pass the result back.
Why It Matters
- Extend capabilities — real-time data, calculations, system control
- Integrate with existing systems — CRM, databases, APIs
- Automate complex tasks — multi-step agentic workflows
- Accurate data — real values instead of hallucinations (prices, schedules, live data)
The 4-Step Cycle
# Step 1: Define the tool and send a request
tool_definition = {
"name": "get_stock_price",
"description": "Retrieves the current stock price for a given company",
"input_schema": {
"type": "object",
"properties": {
"company": {
"type": "string",
"description": "The company name to fetch stock data for"
}
},
"required": ["company"]
}
}
response = client.messages.create(
model="claude-3-opus-20240229",
messages=[{"role": "user", "content": "How many shares of General Motors can I buy with $500?"}],
max_tokens=500,
tools=[tool_definition]
)
# Step 2: Claude responds with stop_reason="tool_use"
# Step 3: You call get_stock_price("General Motors") and return the result
# Step 4: Claude formulates the final answer using the data
Real-World Use Cases
- Enterprise data: CRM, ERP, ITSM integration
- Financial analysis and reporting
- Healthcare diagnostics with EHR
- Customer support with knowledge bases
- Software development: IDE, VCS, issue trackers
Sketch the 4-step tool use cycle for a pizza ordering chatbot with a check_menu tool. Describe each step in words, including what data flows in each direction.
Copy and adapt to your context. Text in angle brackets should be replaced.
I'm building a Claude agent with tools. Business scenario: <describe the task> What tools do I need? For each tool, suggest: 1. Name and description 2. Input parameters (JSON Schema) 3. What the function should return 4. When Claude should call it
- Thinking Claude executes code itself — it only requests a call.
- Forgetting to return tool_result — Claude is waiting and can't continue.
- Writing weak tool descriptions — Claude decides which tool to call based on description.
- A good tool description matters more than a good prompt — Claude reasons from it.
- stop_reason='tool_use' is your trigger to execute the function.
- Steps 3 and 4 are optional: sometimes you only need the tool_use request from Claude.
When Claude needs real-time data, needs to take action in an external system, or needs guaranteed accurate numeric calculations.
When the task can be handled with prompting alone and no external data — tool use adds latency and complexity.