Lesson 34.1 · 1 of 6 · 5 min read · Reviewed 24 Nov 2026
Names and descriptions that don't confuse
By the end, you can
- Write tool names and descriptions that Claude picks correctly.
- Spot overlapping tools that confuse selection.
Claude never sees your code, only the definition. The name and description decide when a tool gets used.
A weak description
{"name": "search", "description": "Searches."}
Searches what? With what input? Returning what?
A strong one
{
"name": "search_help_articles",
"description": "Full-text search over the public help centre. Use for how-to and policy questions. Don't use for questions about a specific customer's account; use get_account for those. Returns up to 5 articles with title, URL and a 200-character snippet."
}
It says what, when, when not, and what comes back.
Watch for overlap
If get_customer and get_order both say “Gets details”, Claude has to guess. Fix it by:
- Naming the data each returns.
- Adding “use this when…” and “don’t use this for…” lines that point at each other.
- Merging tools that really do the same thing.
Names
Use clear, specific verbs and nouns: search_help_articles, issue_refund, get_order_status. Prefixes such as crm_ or billing_ help when there are many tools.
Key points
- Claude chooses tools from their names and descriptions alone, so these are prompts.
- Say what the tool does, when to use it, when not to, and what it returns.
- Two tools with overlapping descriptions cause wrong picks; merge them or sharpen the line between them.
Sharpen two vague tool descriptions
Rewrite two look-alike tools so the model picks the right one first time.
You will have: Two sharpened tool definitions and a run where the order question goes straight to the order tool.
Steps
- Run the starter and look at which tool gets picked, and how many tries it takes.
- Rename the tools get_customer_profile and get_order_status.
- Say what each returns and when to use it, and give each the right id field.
- Run it again and compare the picks and the answer.
Done when
- The first and only pick is get_order_status.
- The answer mentions the espresso machine and its status.
- The customer tool's description does not mention orders.
Open in the Playground No API key needed.
Starter code (Python)
# Sharpen two vague tools so the model picks the right one for an order question.
import json
import anthropic
client = anthropic.Anthropic()
ORDERS = {"A-1042": {"item": "Espresso machine", "status": "delivered"}}
# TODO: these two tools look the same to the model. Give each a specific name (get_customer_profile,
# TODO: get_order_status), say what it returns and when to use it, and name the right id field.
tools = [
{"name": "lookup_customer", "description": "Looks up details.",
"input_schema": {"type": "object", "properties": {"id": {"type": "string"}}, "required": ["id"]}},
{"name": "lookup_record", "description": "Looks up details.",
"input_schema": {"type": "object", "properties": {"id": {"type": "string"}}, "required": ["id"]}},
]
def run_tool(name, args):
if name in ("get_order_status", "lookup_record") and (args.get("order_id") or args.get("id")) in ORDERS:
oid = args.get("order_id") or args.get("id")
return json.dumps({"id": oid, **ORDERS[oid]}), False
return json.dumps({"error": f"{name} cannot answer this"}), True
messages = [{"role": "user", "content": "Where is my order A-1042?"}]
picked = []
for _ in range(5):
r = client.messages.create(model="claude-sonnet-5-5", max_tokens=400, tools=tools, messages=messages)
messages.append({"role": "assistant", "content": r.content})
if r.stop_reason != "tool_use":
break
results = []
for b in r.content:
if b.type == "tool_use":
picked.append(b.name)
out, err = run_tool(b.name, b.input)
results.append({"type": "tool_result", "tool_use_id": b.id, "content": out, "is_error": err})
messages.append({"role": "user", "content": results})
print("picked:", ", ".join(picked))
print("answer:", "".join(b.text for b in r.content if b.type == "text"))
Show a solution
# Sharpen two vague tools so the model picks the right one for an order question.
import json
import anthropic
client = anthropic.Anthropic()
ORDERS = {"A-1042": {"item": "Espresso machine", "status": "delivered"}}
tools = [
{"name": "get_customer_profile",
"description": "Profile for one customer: name, email and plan. Use for account and profile questions only.",
"input_schema": {"type": "object", "properties": {"customer_id": {"type": "string", "description": "Customer id, e.g. C-77"}}, "required": ["customer_id"]}},
{"name": "get_order_status",
"description": "Status of one order by its id: item, delivery status and tracking. Use when the customer asks where an order is.",
"input_schema": {"type": "object", "properties": {"order_id": {"type": "string", "description": "Order id, e.g. A-1042"}}, "required": ["order_id"]}},
]
def run_tool(name, args):
if name == "get_order_status" and args.get("order_id") in ORDERS:
return json.dumps({"id": args["order_id"], **ORDERS[args["order_id"]]}), False
return json.dumps({"error": f"{name} cannot answer this"}), True
messages = [{"role": "user", "content": "Where is my order A-1042?"}]
picked = []
for _ in range(5):
r = client.messages.create(model="claude-sonnet-5-5", max_tokens=400, tools=tools, messages=messages)
messages.append({"role": "assistant", "content": r.content})
if r.stop_reason != "tool_use":
break
results = []
for b in r.content:
if b.type == "tool_use":
picked.append(b.name)
out, err = run_tool(b.name, b.input)
results.append({"type": "tool_result", "tool_use_id": b.id, "content": out, "is_error": err})
messages.append({"role": "user", "content": results})
print("picked:", ", ".join(picked))
print("answer:", "".join(b.text for b in r.content if b.type == "text"))
Do it Fix two vague tools in the Tool design lab in the Playground. No API key needed.