Tools make the difference between a "smart writer" and an "agent that can act." Through tool use, an AI agent can interact with the real world: query databases, call APIs, create files, send emails.
Modern LLMs (Claude, GPT-5, Gemini) support native function calling:
const tools = [{
name: "search_customers",
description: "Search customers by name or email",
parameters: {
type: "object",
properties: {
query: { type: "string", description: "Search term" },
limit: { type: "number", description: "Max results", default: 10 }
},
required: ["query"]
}
}]
| Principle | Description |
|---|---|
| Single Responsibility | One tool = one clearly defined task |
| Clear Description | The LLM must understand when to use which tool |
| Validation | Validate input parameters before executing the action |
| Idempotency | Same input → same result (where possible) |
| Error Handling | Clear error messages the LLM can process |
Practical tip: Start with 3–5 well-defined tools. More tools = more confusion for the LLM. If accuracy drops, you probably have too many similar tools.