Junior interview question
In tool calling, who executes the tool, and what does the model need in order to use the result?
Model answer
For tools you define, your application. The model only emits a name and arguments, such as lbs_to_kg with {"lbs":40}.
Scroll sideways to see the whole diagram
The context holds the tool definitions and the user's question.
Text version
- The context holds the tool definitions and the user's question.
- The model emits a structured call: a tool name and JSON arguments. With Anthropic's API the reply stops with stop_reason "tool_use".
- The call is text the model generated. Your code checks it before anything runs.
- Your code executes the function. The model has no hands: it only asked.
- The output goes back into the context (a tool_result block) and the model runs again, until it answers instead of calling.
After AI Engineering, Ch. 6 "Function calling", and Anthropic, "Tool use with Claude" (fetched 2026-10-21). Illustrative call.
Your code runs it and sends the output back, a tool_result in Anthropic's API, in the next request. Every result becomes context: billed tokens the model reads like any other text.
Practise the rest
8 Tools & constraints questions, 492 in all, each with a model answer. Free.
More Tools & constraints interview questions
- The model keeps calling search_orders for refund questions that another tool handles. What do you change first?
- Explain one step of constrained sampling. What does it guarantee, and what doesn't it?
- Your agent has a delete_records tool. What has to happen between the model emitting a call and the delete running?
- Should you turn on grammar-constrained decoding for every structured output? What would you watch?
- Implement a client that spreads LLM calls across several providers, respecting their rate limits and failing over when one is down.
- Design an AI chat for a spreadsheet product that turns commands like sum column K or delete row 5 into validated tool calls on the sheet.