Tool (function) calling
For engineers
Defining tools, running the call loop, returning errors, handling parallel calls and controlling when the model may act
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
What does the model use to decide which tool to call?
Check yourself · 2 of 5
After the model requests a tool call, what must your code do?
Check yourself · 3 of 5
A tool cannot find the requested record. What should it return?
Check yourself · 4 of 5
A response contains three tool requests. What must your next request contain?
Check yourself · 5 of 5
Which tool choice setting forces the model to call one specific tool?
Topics
- Writing tool names, descriptions and input schemas4 min read · How the model chooses a tool from its name and description and fills arguments from its schema
- Running the tool call loop to completion5 min read · Detect a tool request, execute it, return the result with the matching call id, and repeat until a final answer or a step limit
- Returning tool errors the model can act on4 min read · Validating arguments, returning failures as error results with useful messages, and never throwing away the turn
- Handling parallel tool calls in one turn4 min read · Several tool requests in one response: running them concurrently and returning every result in a single reply
- Controlling tool choice and side-effecting actions5 min read · Auto, required, none and named tool choice, plus confirmation before tools that write, pay or send
Start here
- Tool use overview (Claude docs) (opens in a new tab)DocsFree
Anthropic's reference for tool definitions, the tool_use and tool_result blocks, tool_choice and parallel calls.
- Function calling guide (OpenAI) (opens in a new tab)DocsFree
OpenAI's guide to function definitions, the call loop, parallel calls and tool_choice.
- Function calling (Gemini API docs) (opens in a new tab)DocsFree
Google's guide to declaring functions and returning function responses to Gemini.
Scenarios
Helps to know first
110 questions · last verified 2026-12