(Note · · 5 min read)

Your agent keeps calling the wrong tool, and the description is why

When an agent calls the wrong tool or invents a parameter, the instinct is to blame the model and reach for a better one. The description is usually the problem. It is not documentation that sits beside the routing decision — it is the routing decision.

By Md. Habibur Rahman Shohel, full-stack & AI product engineer in Dhaka

The description is the only thing it has

Your agent cannot read the implementation. At the moment of choosing, it has the tool's name, its description, and its parameter schema. Everything it concludes about when to use the tool comes from those three things, so anything you left implicit is simply absent.

Write the description to answer the question actually being asked, which is not what does this do but when should I reach for this instead of something else.

Overlap is what produces guessing

Two tools whose descriptions could both plausibly apply will be chosen between arbitrarily, and the choice will vary run to run. A set containing search_orders, find_order and get_order_details is a set in which the model is guessing, because nothing distinguishes them.

Either merge them or make the boundary explicit in each description, naming the other tool: use this for a known order id; use search_orders when you only have a customer name. Saying what a tool is not for is often more useful than saying what it is for.

Fewer tools, each doing more

A large surface of narrow tools is harder to route than a small one, and every tool costs context on every call. Prefer a handful of clear tools over thirty that shade into one another. If a group of tools is always called in sequence, that sequence is probably the tool.

Where a tool is dangerous or expensive, say so in the description. The model cannot infer cost or irreversibility from a name, and a description that mentions it will measurably change when the tool gets chosen.

Parameters are part of the contract

Invented parameters are almost always under-specified schemas. Give every parameter a description, state the format rather than hoping it is guessed, use enums where the set is closed, and mark what is genuinely required. A date parameter that does not say which format it wants will receive all of them.

Return errors the model can recover from. Not valid is a dead end; expected format YYYY-MM-DD, received 5 December 2026 is an instruction the model can follow on its next attempt.

Test it like routing, not like code

Keep a list of real requests and check which tool gets chosen for each. That set is your regression test, and it is the only way to notice that rewording one description has changed behaviour for a request you were not thinking about. Re-run it whenever descriptions, tools or models change.

Common questions

Why does my AI agent call the wrong tool?

Usually because the descriptions overlap or are vague. At the moment of choosing, the model has only the name, description and parameter schema, so anything left implicit is absent. Make each description say when to use that tool instead of the others, naming them where they are close.

How many tools should an MCP server expose?

Fewer than feels natural. A large surface of narrow tools is harder to route between and costs context on every call. If several tools are always called in sequence, that sequence is probably the tool.

Why does the model invent parameters that do not exist?

Because the schema under-specifies what it wants. Describe every parameter, state formats explicitly, use enums for closed sets and mark what is required. A date field that does not state its format will receive every format.

How do I test tool selection?

Keep a list of real requests and assert which tool is chosen for each. Re-run it whenever a description, tool or model changes — rewording one description routinely changes behaviour for requests you were not considering.

Need something like this built?