Skip to content
mentoor

Topic 2 of 5 · 4 min read

Wrong tool picks from long tool lists

Goal: Find the overlapping or unused tools behind a wrong tool call and reduce the set to what the task needs.

The more tools an agent can choose from, and the more alike they look, the more often it picks the wrong one. Tool choice is a model guess, and a long list makes the guess harder.

Check yourself · 1 of 3

An agent has tools named search, find and lookup with near-identical descriptions. What is the likely result?

Choose one answer

Why it matters

The model chooses a tool by reading names and descriptions. If search_docs, find_docs and query_knowledge_base all sound like "look something up", it may pick any of them, or call two. Anthropic's guidance on writing tools for agents recommends fewer, clearer tools that match how a person would split the task, and clear names that do not overlap. Wrong picks cost a turn, pollute the history with a useless result, and sometimes cause real side effects, such as sending a message through the wrong channel.

How to find the cause

  1. Read the trace. Find the turn with the wrong call. Which tool was called, and which should have been?
  2. Put the two descriptions side by side. Could a careful person tell them apart from the text alone? If not, the model cannot either.
  3. Count calls per tool over a few sessions. Tools never called are candidates to remove. Tools called together every time are candidates to merge.
  4. Check argument names. id, name and query mean different things in different tools; vague names cause wrong arguments.

How to fix it

  • Merge tools that always run together into one with a clear parameter.
  • Rename for the action and the object: create_ticket, not ticket_tool.
  • Add a "use this when / not this, use X" line to descriptions of near neighbours.
  • Remove tools the task never needs.

Before and after

tools = [
    {"name": "search", "description": "Search for things."},
    {"name": "find",   "description": "Find items."},
    {"name": "lookup", "description": "Look up records."},
]

All three read as the same tool. After the review:

tools = [
    {"name": "search_orders",
     "description": "Find orders by customer email or order id. Not for refunds; use create_refund."},
]

One tool, a precise name, and a boundary stated in the description.

What goes wrong

  • Blaming the model first. Often the tool list is what is ambiguous.
  • Fixing it with more prompt text. A long "always use X, never Y" system prompt is a patch for overlapping tools; fix the tools.
  • Merging too far. One giant tool with twenty modes is hard to describe, and the model fills the arguments wrong. Merge steps that belong together, not everything.

Examples

The two lookup tools

[
  { "name": "get_user", "description": "Get a user." },
  { "name": "fetch_user_profile", "description": "Fetch a user's profile." }
]

The agent keeps calling the first and then the second. They hit the same endpoint. Keep one, get_user, and say in its description which fields it returns.

A trace that points at the list

An agent asked to refund an order called search_orders three times, then send_email. The refund tool existed but its description began with the word process, while the user said refund. Renaming it create_refund and adding a line to search_orders ("to refund, use create_refund") fixed the pick.

Key points

  • The model picks tools by reading names and descriptions, so similar-sounding tools cause wrong or duplicate calls.
  • Diagnose from the trace: put the wrongly chosen and the intended tool descriptions side by side and see if they can be told apart.
  • Count calls per tool over several sessions to find unused tools to remove and always-paired tools to merge.
  • Fix ambiguity in the tools (names, boundaries in descriptions) rather than adding rules to the system prompt.
  • Do not merge everything into one tool with many modes; that moves the confusion into the arguments.

Common mistakes

  • Adding a new tool for every small need instead of checking whether an existing one almost covers it.
  • Writing tool descriptions from the developer's view ("wrapper for service X") rather than the task the model faces.
  • Patching wrong picks with prompt rules instead of fixing overlapping tools.
  • Merging many unlike actions into one tool with a mode flag the model must guess.

Check yourself · 2 of 3

A trace shows the agent called the wrong tool. What do you check first?

Choose one answer

Check yourself · 3 of 3

Three tools are always called together in the same order. What is a good change?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic