Tool Use with Claude
Implement tool use with Claude API: define tools, handle tool calls, and build reliable function-calling agents.
Last updated
Tool Use: Giving Claude Superpowers
Tools are how Claude reaches past its training data — to your database, the web, a calculator, an action. This is the exact request/response contract, plus the tool-design skill that separates agents that work from agents that thrash.
Claude never runs your code. When it decides a tool is needed, it emits a structured tool_use block — a JSON request saying “please run get_weather(city="Paris") and tell me the result.” Your code runs the function and hands back a tool_result. That’s the whole mechanism, and it’s a two-message handshake, not a function call. The agent loop (a separate section) just repeats this handshake until Claude is done; here we master the single exchange and, more importantly, how to design the tools so Claude picks the right one.
Related
More in LLM & Agentic
LLM Lifecycle
PreviewComplete lifecycle of large language models from pre-training through fine-tuning, RLHF, and deployment — with architecture diagrams and production considerations.
How LLMs Call Tools
PreviewHow LLMs use function calling and tool use — the mechanics behind tool-calling agents, from prompt engineering to structured output.
When to Fine-Tune: The Decision Framework
PreviewShould you fine-tune at all? A structured decision framework for prompt engineering vs RAG vs fine-tuning.
LoRA, QLoRA & PEFT Methods
PreviewHow LoRA works inside transformer layers, QLoRA for memory-efficient training, and the full PEFT method comparison with code examples.
Get full access to all 87+ sections with code examples, diagrams, and interactive animations.
Unlock Premium