Sub topic 10
Keeping Similar Tools Distinguishable
This chapter assumes you know how a tool definition is structured (name, description, input schema) and have read the chapters on naming, descriptions, and tool granularity. Here you will learn how to stop the model from picking the wrong tool when two tools look alike.
Why overlap causes errors
The model chooses a tool by comparing the user's request with the names and descriptions it can see. If two tools could plausibly handle a request, the choice becomes a guess. Typical symptoms:
- The model calls
search_orderswhen the user gave an exact order ID. - The model alternates between two tools for the same prompt across runs.
- The model calls both tools and merges the results badly.
Overlap usually comes from tools that share a noun (order), share a verb (get, find), or have descriptions that say only "handles orders."
Separate tools by trigger, not by topic
Each tool should answer one question: "When should I use this one?" The most reliable fix is to state the trigger condition in each description and point to the sibling tool for the other case.
In the search_orders definition, the description says "Use this when the user does not give an order ID. If the user gives an order ID, use getorder instead." The `getorder` description should mirror that rule.
{
"name": "get_order",
"description": "Fetch one order by its exact order ID, for example 'ord_1001'. Use this when the user gives an order ID. If you only have a customer or a date, use search_orders instead. Returns id, status, total, and created_at.",
"input_schema": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "Order ID in the form 'ord_' followed by digits, for example 'ord_1001'."
}
},
"required": ["order_id"]
}
}The pair now forms a decision rule. The input the user supplies (an ID or no ID) decides the tool.
Techniques
| Technique | Use it when | Example |
|---|---|---|
| Add "use this when" and "use X instead" lines | Two tools handle related requests | `get_order` vs `search_orders` |
| Make names differ by verb or scope | Names share the same words | `get_order` vs `search_orders`, not `order_lookup` vs `order_find` |
| Describe the return shape | Results differ in size or detail | "Returns one order" vs "Returns up to `limit` orders" |
| Merge the tools | Descriptions need long, fragile rules | One `orders` tool with an `action` enum |
| Remove a tool | Two tools do the same job | Keep the one with the better schema |
If you cannot write a short rule that separates two tools, they are probably badly scoped. Revisit granularity before adding more description text.
Common mistakes
- Pointing only one way. If
search_ordersmentionsget_orderbut not the reverse, the model may still pickget_orderfor vague requests. - Naming a sibling that does not exist. After you rename or remove a tool, update every description that references it.
- Fixing overlap with capital letters. Words like "ALWAYS" and "NEVER" are a weak substitute for a clear trigger condition.
Exercise
A find_customer tool searches by email, and a lookup_customer tool fetches a customer by ID. Models often pick the wrong one. Name two changes that make them distinguishable.
Show answer
Rename them by scope and verb, for example search_customers_by_email and get_customer. Then add trigger lines to both descriptions: use get_customer when you have a customer ID, and use search_customers_by_email when you only have an email, each pointing to the other for the opposite case.