# Tool use

> Tools give a model hands. This topic covers how a model requests a function call and receives the result, how to design a tool schema the model uses correctly, why connecting many models to many tools became a standards problem, how to handle tool errors, and when to let the model call several tools at once.

Page: https://schubergphilis.github.io/ai-training/topics/building-agents/tool-use/
License: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/

*Building agents* · topic `building-agents/tool-use`

Tools give a model hands. This topic covers how a model requests a function call and receives the result, how to design a tool schema the model uses correctly, why connecting many models to many tools became a standards problem, how to handle tool errors, and when to let the model call several tools at once.

## Concepts

- **Function calling**: The mechanism by which a model asks for a tool to run. The developer sends tool definitions with the prompt; the model replies with a structured request naming a tool and its arguments instead of prose; the application executes it and sends the result back as a new message. The model never runs code itself; it emits a request the harness fulfils. [glossary](https://schubergphilis.github.io/ai-training/glossary/#function-calling)
- **Tool schema design**: Writing the name, description and parameter schema that tell the model what a tool does and how to call it. The description is a prompt: it must say when to use the tool, what it returns and what it must not be used for. Few, well-named, strictly typed parameters with examples outperform flexible ones. Most tool misuse is a schema problem, not a model problem. [glossary](https://schubergphilis.github.io/ai-training/glossary/#tool-schema-design)
- **N x M integration problem**: With N agent applications and M tools or data sources, every pairing needs its own integration unless both sides speak a shared protocol. This is what made a standard for tool connections necessary: a tool exposed once through the protocol works with every compliant agent, turning N times M integrations into N plus M. [glossary](https://schubergphilis.github.io/ai-training/glossary/#n-x-m-integration-problem)
- **Error handling**: What happens when a tool fails, times out or returns something unexpected. The result should go back to the model as a clear, structured error it can reason about, not an exception that ends the run or an empty string it treats as success. Design tools to fail loudly and informatively, and decide in the harness how many retries a step gets. [glossary](https://schubergphilis.github.io/ai-training/glossary/#error-handling)
- **Parallel calls**: Letting the model request several independent tool calls in one turn, which the harness executes concurrently and returns together. It cuts latency and round trips for read-heavy work such as fetching several files. Calls that depend on each other's results must stay sequential, and side-effecting tools need care because concurrent execution can reorder them. [glossary](https://schubergphilis.github.io/ai-training/glossary/#parallel-calls)
- **Tool approval**: Pausing before chosen tools run so a person can approve each call with its exact arguments. The harness applies its own rules first, and a call that no rule settles goes to an approval step, which can allow it, allow it with changed arguments, or deny it with a message. The message goes back to the model, so the model can adjust and continue. Approval belongs on tools with side effects, where a wrong call is costly. [glossary](https://schubergphilis.github.io/ai-training/glossary/#tool-approval)

## Links

- **Builds on:** [What an agent is](https://schubergphilis.github.io/ai-training/topics/concepts/what-is-an-agent/)
- **Leads to:** [The agent loop and harness](https://schubergphilis.github.io/ai-training/topics/building-agents/agent-loop/)
- **Competencies drawing on it:** [Builds a tool-using agent loop](https://schubergphilis.github.io/ai-training/competencies/building-agents/builds-agent-loop/)

## Lessons

- [Approving a risky tool call](https://schubergphilis.github.io/ai-training/building-agents/approving-a-tool-call/) (tutorial)
- [What a tool call looks like on the wire](https://schubergphilis.github.io/ai-training/building-agents/how-a-model-calls-a-tool/) (explanation)
- [Several tool calls in one turn](https://schubergphilis.github.io/ai-training/building-agents/parallel-tool-calls/) (tutorial)
- [When a tool fails](https://schubergphilis.github.io/ai-training/building-agents/tool-errors/) (tutorial)
- [Writing a tool schema the model uses correctly](https://schubergphilis.github.io/ai-training/building-agents/tool-schemas/) (tutorial)

## Sources

- `AEC-03` [Tools, giving agents hands: function calling, schema design, the N x M problem](https://lsimons.github.io/agent-engineer-course/03-tools-giving-agents-hands/), Agent Engineer Course (course)
- `Academy claude-platform-101` [Claude Platform 101](https://academy.claude.com/courses/claude-platform-101), Claude Academy (course)
- `Academy building-with-the-claude-api` [Building with the Claude API](https://academy.claude.com/courses/building-with-the-claude-api), Claude Academy (course)
- `Academy introduction-to-model-context-protocol` [Introduction to Model Context Protocol](https://academy.claude.com/courses/introduction-to-model-context-protocol), Claude Academy (course)
- `Claude Code agent sdk permissions` [Configure permissions (Agent SDK)](https://code.claude.com/docs/en/agent-sdk/permissions), Claude Code documentation (reference)
- `Claude Code agent sdk user input` [Handle approvals and user input](https://code.claude.com/docs/en/agent-sdk/user-input), Claude Code documentation (reference)
