# Tool Use

> Let the LLM emit typed tool calls instead of free-form text — deterministic execution outside the model, schema validation at the boundary.

- **Category**: Agentic AI
- **Subcategory**: Tool Use & Environment
- **Canonical URL**: https://designpattern.fyi/patterns/tool_use/

---

## Description
**Intent**: Replace fragile text-parsing with typed, validated tool calls for any action that touches the outside world.

**Context**: Your agent needs to read customer records, cancel orders, write to a database, render charts, or post to a channel. The model alone can't do these safely, and parsing intent from free-form text is brittle and error-prone.

**Solution**: Define a typed tool palette. The model emits tool calls conforming to a JSON Schema; the host validates and executes; results return as structured tool results. The agent becomes a thin client of a deterministic toolkit — the toolkit, not the model, is the locus of capability and audit.


## Use Cases
- The model must affect external state or query authoritative systems.
- Operations are typed and a JSON Schema can describe them.
- Audit and validation need to live outside the model.





## Trade-offs


### Advantages

- Invalid calls are rejected at the schema layer rather than as runtime errors.

- The toolkit — not the model — is the source of truth for capability and audit.

- Tools can be tested and versioned independently of prompts.




### Considerations & Drawbacks

- Tool palette design becomes the bottleneck — bad tool definitions propagate to every call site.

- Models with weaker function-calling support drift; schema strictness must be tuned per model.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/tool-use/)

