Tool Definition — Describing a Tool So It Gets Used Well
Tripmate has a tool called lookup with the description "Looks things up." It gets called for weather, for trains, for Asha's calendar — and fails at most of them. The code behind it is fine. The model simply cannot tell what the tool is for, because the definition is the only thing it sees.
The rule
The model sees only the definition — write it like documentation for a stranger.
A tool definition has three parts, and the model relies on each:
- Name — short, specific, verb-first:
search_trains, notlookuportool2. - Description — what it does, when to use it, when not to, and what comes back.
- Input schema — the arguments, their types, which are required, and allowed values. Most providers use JSON Schema for this.
{
"name": "search_trains",
"description": "Search scheduled trains between two stations on one date. Use this to find options before booking. Returns up to 10 trains with departure, arrival, class and fare. Does not book anything.",
"input_schema": {
"type": "object",
"properties": {
"from": { "type": "string", "description": "Origin station code, e.g. PUNE" },
"to": { "type": "string", "description": "Destination station code, e.g. JP" },
"date": { "type": "string", "description": "Travel date as YYYY-MM-DD" },
"class": { "type": "string", "enum": ["SL", "3A", "2A", "1A"] }
},
"required": ["from", "to", "date"]
}
}The enum limits class to four real values, the date format is spelled out, and "Does not book anything" tells the model this tool is safe to call freely.