How to write tool descriptions: the same tool, described twice
By Christophe Paka · Facts checked on 23 October 2026
Your agent keeps passing the wrong argument. Or it calls a tool for a job the tool cannot do, then answers with a number that looks right. Is a longer prompt the fix?
Often the fault is a sentence nobody wrote. The model never asks what a tool means. It guesses and answers anyway, so a vague tool turns into a confident wrong answer. This page shows how to write tool descriptions using one example from Anthropic's tool docs: the same stock price tool, described badly and well, side by side.

Use this diagram on your site
Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.
How to read this figure
Read the poor version, top left. The red panel starts with the description: "Gets the stock price for a ticker." Seven words. The ticker input is a bare string, with no hint of what a ticker looks like. A ticker is the short code for a company's shares on a stock exchange.
Read the five open questions. Under it, five questions the model still cannot answer. Which exchanges count as valid? What currency does it return? Current price, or any past price? What will this tool refuse to answer? What does a ticker even look like?
Follow the arrow to the failure. An arrow marked "leaves the model guessing" points to the orange Failure mode box. The model does not stop. It fills the gap with a plausible value and answers anyway. The docs show this on a weather tool, where Claude invented both the location and the unit.
Read the good version, one job each. The green panel has five boxes, one sentence each. What it does: retrieves the current stock price for a ticker. What counts as valid input: a symbol on a major US exchange like NYSE or NASDAQ. What it returns: the latest trade price in USD. When to reach for it.
Stop at the last box. The last box has the thickest border: what it will NOT do. "It will not provide any other information about the stock or company." This boundary sentence keeps the tool out of jobs it cannot do. Under the panel, a note: the ticker input gets its own line, such as AAPL for Apple Inc.
Key takeaways
- Write at least three or four sentences per tool: what it does, valid input, what it returns, when to use it.
- End every description with a boundary sentence that starts "It will not".
- Give each input its own description with an example value, not a bare type.
Try this: rewrite your most misused tool
Pick the tool your agent gets wrong most often. If none is misused yet, use the poor stock price tool from the figure.
- Run about ten real requests and log every tool call: the tool name and the exact input. Mark each one right, wrong input, wrong tool, or should not have called.
- Turn each mistake into the question behind it. "It passed the company name" becomes "the description never says what a ticker looks like".
- Rewrite the description with one job per sentence, in the order of the green panel, and end with what the tool will not do.
- Describe every input on its own line, and mark as required only what is truly required.
- Rerun the same ten requests and compare the marks.
Expected result: The mistake you named is gone from the log. Often a new one shows up; it is your next rewrite. Keep the ten requests as a test you rerun after every change.
Questions readers ask
How do you make sure your AI agents don't hallucinate when they act?
Part of it starts in the tool description. When a description leaves a gap, the model fills it with a likely value and acts on it. Say what counts as valid input, what the tool returns, and what it will not do. When a mistake still repeats, change the input's shape, for example a list of allowed values, so the wrong call cannot be written.
Is a longer tool description worth the extra tokens?
Yes. Anthropic calls detailed descriptions the most important factor in tool performance. The description is resent every turn, so the fix for cost is fewer, better tools, not shorter descriptions. See where each part of a tool call is billed.
How should I name my tools?
Start each name with its service, such as github_list_prs rather than list_prs. Merge related actions into one tool with an action input, because fewer, more capable tools are easier for the model to tell apart. Names may use only letters, digits, underscores and hyphens; a dot or a space returns a 400 error.
Sources: Define tools (Claude docs); Writing tools for agents (Anthropic).
This figure is from AI Agents Made Crystal Clear, chapter 5.
The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.
Get the book


