Task 2.1
Tool Descriptions
Writing tool definitions that Claude can select accurately
📘What You Need to Know
What You Need to Know
Tool descriptions are documentation for Claude — not comments for human developers. Every time Claude considers which tool to call, it reads the name, description, and input_schema to decide what to invoke and with what parameters. Vague descriptions produce wrong tool selection, malformed parameters, and failed workflows.
On the exam, tool description questions almost always reward the most detailed answer: clear purpose, input formats with examples, edge cases, parameter constraints, and explicit guidance on when NOT to use the tool. Treat each description like API documentation written for an intelligent but literal reader.
Tool Descriptions as Documentation
A production-quality tool description answers five questions before Claude ever calls the tool:
- •What does this tool do? State the purpose in one clear sentence.
- •When should Claude use it — and when should it use a different tool instead?
- •What does each parameter mean, including type, format, valid ranges, and examples?
- •What does the return value look like, including success and failure shapes?
- •What edge cases exist — empty results, rate limits, invalid inputs, permission boundaries?
On the exam, the correct answer always has the most detailed description with formats, examples, edge cases, and anti-use guidance. Short generic descriptions are almost always wrong.
Naming and Disambiguation
When multiple tools perform similar operations, names and descriptions must make the distinction obvious. Use consistent verb_noun naming — lookup_customer, process_refund, search_inventory — so related tools cluster logically in Claude's context.
If you have search_database and search_web, the descriptions must explain the boundary explicitly: search_database queries internal PostgreSQL data (orders, customers, inventory); search_web retrieves current external information not stored in your systems. Without this disambiguation, Claude picks based on superficial keyword overlap and frequently chooses the wrong data source.
Pair similar tools with contrasting "Use when..." and "Do NOT use when..." clauses. The exam tests whether you can distinguish internal vs external search, read vs write operations, and lookup vs mutation tools.
Good vs Bad Examples
Bad: "lookup_order: Searches for order information." This tells Claude nothing about ID format, return fields, or when to prefer lookup_customer instead.
Good: "lookup_order: Retrieves order details by order_id (format: ORD-XXXXX). Returns status, line items, shipping address, and total. Use for refund eligibility and status checks. Do NOT use for creating new orders — use create_order instead. Returns empty results (not an error) when order_id is valid but not found."
The difference is not length for its own sake — each added detail removes an ambiguity that would otherwise cause incorrect tool calls or wrong parameter values.
// BAD — vague, no format, no boundaries
{
"name": "lookup_customer",
"description": "Gets customer data",
"input_schema": {
"type": "object",
"properties": { "id": { "type": "string" } }
}
}
// GOOD — exam-quality description
{
"name": "lookup_customer",
"description": "Retrieves customer profile by customer_id (format: CUST-XXXXX) or email. Returns name, plan tier, account status, and order history summary. Use when the agent needs account-level context. Do NOT use for order-specific details — use lookup_order instead. Returns empty result (not error) when customer not found.",
"input_schema": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "Customer ID in CUST-XXXXX format. Example: CUST-10482"
},
"email": {
"type": "string",
"description": "Customer email as fallback lookup. Example: jane@example.com"
}
}
}
}Parameter Descriptions Matter Too
The input_schema property descriptions are part of the tool documentation Claude reads. A parameter named "id" with no description forces Claude to guess the format. A parameter described as "Order ID in ORD-XXXXX format. Example: ORD-92847" dramatically reduces malformed calls.
Document constraints directly in parameter descriptions: required vs optional, enum values, numeric ranges, and mutually exclusive fields. Edge case documentation belongs in both the top-level description and the relevant parameter — rate limits, empty result semantics, and auth requirements should never be implicit.
Never rely on the system prompt to explain tool behavior that belongs in tool descriptions. Prompt instructions compete with dozens of tools for attention; per-tool descriptions are always in scope when Claude evaluates that specific tool.
⚠️Exam Traps
Trap: Vague tool descriptions like "searches for data" or "handles customers"
Why it's wrong: Ambiguity causes wrong tool selection, incorrect parameters, and silent misuse of similar tools.
Trap: Missing edge case documentation in tool schemas
Why it's wrong: Claude cannot handle boundary conditions it was not told about — empty results, rate limits, invalid formats.
Trap: Similar tools with indistinguishable names and descriptions
Why it's wrong: Claude selects based on superficial keyword overlap when search_database and search_web look interchangeable.
Trap: Relying on the system prompt instead of tool descriptions for format specs
Why it's wrong: System prompt guidance is not reliably in scope during per-tool evaluation; descriptions are always read.
✓Concept Check
Which tool description will produce the most reliable tool selection?
🔨Build Exercise
Beginner30 minutesWrite Production-Quality Tool Definitions
What you'll learn
- •Create tool schemas with exam-quality descriptions
- •Practice naming and disambiguation for similar tools
- •Compare selection accuracy between vague and detailed definitions