How it works · 25 of 37 Core
What are tool calling and structured output in AI models?
The model asks, your app does
Tool calling & structured output: A model can ask the app to run a tool (search, calculator, booking API) by replying in a fixed format, then use the result.
Loading the animation…
Say it like this The model can't do things itself: it writes an exact request for a tool, your app runs it, and the model turns the result into an answer.
Under the hood — for builders
- What the slip really is
- You describe each tool once: its name, what it does, and the inputs it takes. The model replies with a filled-in request (a tool call), not with words.
- The loop your app runs
- Each answer says whether the model wants a tool. While it does, your app runs it and sends the result back; when it stops asking, you have the answer.
- Tools beat guessing at sums
- A small model that learned to call a calculator solved far more maths word problems than a model 26 times its size answering alone.
- Typical cost
- Turning tools on adds a hidden instruction: 286 tokens on Claude Opus 5, 497 on Sonnet 4.6, plus your tool descriptions.
- Make it exact
- Anthropic's strict: true makes every tool call “always match your schema exactly”: right fields, right types.
- Watch out
- Models invent inputs: Anthropic's own docs show a call adding a “unit” the tool never asked for. Check every call before running it.
- Watch out
- Without help, models tend to “hallucinate the wrong usage of an API call” (Gorilla, UC Berkeley).
- Sources
- Anthropic, Tool use with Claude and How tool use works (platform.claude.com/docs) · Schick et al. (Meta AI), Toolformer: Language Models Can Teach Themselves to Use Tools, 2023 (arXiv 2302.04761) · Patil et al. (UC Berkeley), Gorilla: Large Language Model Connected with Massive APIs, 2023 (arXiv 2305.15334).
What happens in the tool calling & structured output animation, step by step?
- The model learned from old text. It can't know today's weather.
- So it writes a precise request: which tool, and what to put in.
- Your app, not the model, runs the tool: here, the weather service.
- The result rides back, and the model turns it into an answer.
- Your turn: ask something else. Which tool will it pick?
What everyday example explains tool calling & structured output?
A manager who can't use the till but can tell the cashier exactly what to ring up.
Why should a team care about tool calling & structured output?
The bridge from chatting to doing.