Designing good tools: names, descriptions, inputs and errors
Agents & Tool Calling · 10 questions
Short notes
Key idea
The model only knows a tool from its name, description and parameters. Design tools like an API for a new colleague: clear purpose, simple inputs, helpful outputs and errors it can act on.
Syntax
- Name: a verb and an object,
search_orders, nottool2. - Description: what it does, when to use it, when not to, and what it returns.
- Parameters: few, typed, with formats in the description ("date as YYYY-MM-DD") and enums for fixed choices.
- Output: short and relevant; don't dump a whole database row with 60 fields.
- Errors: say what went wrong and how to fix it ("no order 4471; ask the customer to check the number").
Example
Bad: query(sql: str), which is open-ended and risky. Better: get_order_status(order_id: int) and list_recent_orders(phone: str, limit: int = 5): narrow, safe and obvious when to use.
Traps
- Overlapping tools (
find_order,search_order,lookup_order) confuse the model. - Too many tools make choice worse; group or route them.
- Raw stack traces as errors don't help the model recover.
- Huge outputs waste context; paginate or summarise.
Want the full lesson with step-by-step examples, a project and a certificate? Agents & Tool Calling course, ₹180 →
- Question 1easy
Which tool name and description will a model use most reliably?
- Question 2medium
Which tool error leads the model to the best next step?
- Question 3medium
Why is
update_order(order_id, field, value)a poor tool for an agent? - Question 4easy
Which tools need extra checks or approval? What does this print?
specs = {"get_order_status": "read", "search_help": "read", "request_refund": "action", "cancel_order": "action"} print(sorted(name for name, kind in specs.items() if kind == "action")) - Question 5medium
What does this print?
from typing import Literal from pydantic import BaseModel, ValidationError class Refund(BaseModel): reason: Literal["damaged", "wrong item", "not delivered", "other"] try: Refund(reason="I just don't like it") print("accepted") except ValidationError: print("rejected")
Designing good tools: names, descriptions, inputs and errors
Designing good tools: names, descriptions, inputs and errors
Designing good tools: names, descriptions, inputs and errors
Designing good tools: names, descriptions, inputs and errors
Designing good tools: names, descriptions, inputs and errors
5 more questions on this topic, with hints, and tests
Sign up free for 21 days of every question and test.