How to Write a Tool Description for an Agent

For an AI agent, a tool description is the documentation, the interface and the instruction, all at once. When an agent picks the wrong tool, the description is often to blame.

How to Write a Tool Description for an Agent — Troiana insight cover

In short

A good tool description says what the tool does, when to use it, when not to use it, what each parameter means, and what comes back. Write it for a capable new colleague who knows nothing about your system. Use clear names, specific types, examples and useful error messages. Keep the tool set small, then test with real tasks and refine according to the mistakes you see.

Why it matters so much

A model chooses tools by reading their names and descriptions. It can't look at your source code or ask a colleague. So Anthropic's guidance stresses that detailed descriptions are the most important factor in tool performance, and it recommends several sentences for each tool. See what an AI agent is.

Anthropic's article on writing tools for agents makes a further point: tools are a contract between deterministic systems and non-deterministic agents, so you should design them for agents, instead of just wrapping your API.

What the model has to go on
get_data
Gets data.
A capable new colleague could use this
get_order_status
Look up the current status of
one customer order.
The model chooses from names and descriptions, so these are the interface.

A bad description and a good one

Bad:

{
  "name": "get_data",
  "description": "Gets data.",
  "input_schema": {
    "type": "object",
    "properties": { "id": { "type": "string" } }
  }
}

The agent has no idea what data it gets, what the ID refers to, or when to use it.

Good:

{
  "name": "get_order_status",
  "description": "Look up the current status of one customer order. Use this when
a customer asks where their order is, or whether it has shipped. Returns the status,
carrier, tracking number and estimated delivery date. Don't use this to change an
order; use update_order. Returns an error if the order isn't found.",
  "input_schema": {
    "type": "object",
    "properties": {
      "order_id": {
        "type": "string",
        "description": "Order number, in the format ORD-12345. It's shown in the
customer's confirmation email. Don't guess it; ask the customer if it isn't known."
      }
    },
    "required": ["order_id"]
  }
}

What to include

  1. What it does, in plain language
  2. When to use it, with typical triggers
  3. When not to use it, especially if another tool is similar
  4. What each parameter means, with its format and an example
  5. What comes back, so that the agent knows what to expect
  6. Limitations: date ranges, how many results, permissions
  7. Side effects: does it send, charge or delete something?
  8. Whether it's safe to repeat

Naming

  • Use clear verbs and nouns: search_customers, create_invoice
  • Avoid vague words: handle, process, do_stuff
  • Group related tools: a shared prefix, like billing_create_invoice, helps when you have many, and it helps if tools from several services are in use
  • Don't let two tools seem similar. If search_docs and find_documents both exist, the agent will have to guess

Design parameters well

Use specific types. Use enums where the values are fixed:

"status": {
  "type": "string",
  "enum": ["open", "paid", "overdue"],
  "description": "Filter by invoice status."
}

Reduce ambiguity. user_id is better than user. start_date (YYYY-MM-DD) is better than date.

Use fewer parameters. Provide sensible defaults, so that the simple case stays simple.

Accept human-friendly identifiers where you can. Long UUIDs are easy for a model to mangle. Anthropic's guidance suggests that agents tend to do better with natural language names than with cryptic IDs.

Make illegal states impossible. Don't have a free-text field, if it can only hold three values.

Return useful results

A 200-field record
{"id": "ORD-1042",
 "created_by_system": "…",
 "internal_flag_7": null,
 … 197 more fields }
Three fields
{"order": "ORD-1042",
 "status": "shipped",
 "eta": "2026-11-09"}
An invented result. Everything a tool returns goes into context and costs tokens, and extra fields give the model more to get confused by.

What your tool returns is context for the agent, and it costs tokens.

  • Return only what's needed. Don't send a 200-field record when three fields will do.
  • Paginate or limit. Set a sensible default, and say so.
  • Offer a detail level. A response_format of concise or detailed can be useful for large data.
  • Include helpful context, such as a total count and whether there's more.
  • Treat returned text as untrusted, if it comes from outside. See how to stop prompt injection.

Write errors the agent can act on

Agents can often recover if your message tells them how.

UnhelpfulHelpful
Error 400start_date must be in YYYY-MM-DD format. You sent "next Friday".
Not foundNo order ORD-99999. Check the number, or search with search_orders using the customer's email.
ForbiddenThis account can't issue refunds above €100. Ask a manager to approve it.
Rate limitedToo many requests. Try again in 30 seconds.

See how to handle LLM failures gracefully.

Keep the tool set small

Every tool definition takes up context, and too many options lead to more mistakes.

  • Build tools for tasks, not for every API endpoint. One schedule_meeting tool may be better than separate tools for listing calendars, checking availability and creating an event.
  • Merge overlapping tools.
  • Load tools only when needed, if your platform supports this.
  • Remove what's never used.

See skills vs subagents for other ways of loading capabilities only when needed, and context engineering vs prompt engineering.

Security and safety

A description is not a security control. The model might ignore it, or be tricked.

  • Enforce permissions in the tool's code, not in its description. “Only use for the current user” isn't protection. Check the user on the server.
  • Validate every input, like any public API. See how to prevent SQL injection.
  • Require confirmation for risky actions. See how to put a human in the loop.
  • Offer a dry run, for high-impact tools.
  • Prevent duplicates with idempotency keys.
  • Treat third-party tool descriptions as untrusted. Descriptions from an MCP server can carry hidden instructions. See is MCP secure? and how to build an MCP server.

How to test a description

Don't assume that it works just because it reads well.

  1. Write realistic tasks, including ambiguous ones. “Has Ana's parcel arrived?” is better than “Call get_order_status”.
  2. Run each several times, recording which tool was picked, and with what arguments.
  3. Look at the failures. Wrong tool? Bad arguments? Too many calls? Took a long time?
  4. Read the model's reasoning, where it's available, for signs of confusion.
  5. Change one thing at a time, then run it again.
  6. Measure: correct tool rate, task completion, number of calls and tokens used.
  7. Include cases where no tool should be used.

Keep this as a permanent test set, and run it whenever you change a description or switch models. See how to evaluate an LLM feature and how to log and debug AI features.

You can also ask a model to review your tool descriptions, and to suggest improvements based on transcripts of failed runs. It's often surprisingly useful, as long as you test the results.

A quick checklist

  • Could a new colleague use this tool without asking questions?
  • Is it clear when to use this tool rather than another?
  • Are the formats for every parameter specified?
  • Are side effects stated?
  • Do errors say how to fix the problem?
  • Are permissions enforced in code?
  • Have you tested it with real tasks?

If you're building agents or an MCP server and want them to work reliably, book a call.

Common questions

What makes a good tool description for an AI agent?

It explains what the tool does, when to use it, when not to, what each parameter means, what's returned and any side effects. It should be clear enough for a capable new colleague with no knowledge of your system. Several sentences are usually needed.

How long should a tool description be?

Long enough to remove ambiguity, usually several sentences, rather than a single line. Anthropic recommends this for its tool use. Avoid padding, as definitions use context on each request. Move long reference material elsewhere, and test whether each line helps.

Why does my agent keep choosing the wrong tool?

It's often because of vague or overlapping descriptions, or similar names. Say when to use each tool and when not to, merge overlapping ones and reduce the total number. Test with real tasks, then see where it goes wrong.

Can a tool description protect against misuse?

No. A description is guidance, and models can ignore it or be manipulated. Enforce permissions and validation in the tool's code on the server, and require human approval for risky actions, whatever the description says.

Have something worth building right?