By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Models don't read your documentation. They read your tool name, description, and schema — that's the entire interface. Most agent failures trace back to poorly designed tools that confuse the model about what they do, what arguments they need, or how to interpret the result. Getting this right is non-negotiable.
Write tool descriptions for a model, not for humans. Be explicit about what the tool does, what it returns, and any constraints. The model has no other context.
| Aspect | Weak | Strong |
|---|---|---|
| Name | do_it, query2 | search_customers, create_invoice (verb + noun) |
| Description | 'Searches stuff' | 'Find customers by name or email. Returns up to 20 matches with id, name, plan. Use get_customer for full details.' |
| Parameters | One free-form string 'input' | Typed fields with enums, ranges and descriptions |
| Output | A 50 KB raw JSON dump | Compact, relevant fields; a clear next-step hint |
| Errors | Stack trace or silent failure | A short message the model can act on ('date must be YYYY-MM-DD') |
| Scope | One tool that does 12 things | Small focused tools (but not 200 of them) |
Protocol errors — unknown tool, invalid arguments, malformed input — should be returned as JSON-RPC errors (like -32602). The host handles these as infrastructure problems.
Tool execution errors are different. The tool ran, but the task failed: the API was down, the resource wasn't found, permission was denied. Return a normal result with isError set to true and include a helpful message. The model can read that message and decide how to recover.
Tools can carry annotations that hint to the host whether they're read-only, destructive, or idempotent. These help clients decide whether to require user confirmation or retry logic.
| Annotation | Meaning | Default if absent |
|---|---|---|
| readOnlyHint | Does not change anything | false |
| destructiveHint | May delete or overwrite | true (when not read-only) |
| idempotentHint | Repeating it is harmless | false |
| openWorldHint | Reaches outside systems (web, third parties) | true |
Annotations are hints from the server. A host should not trust them from an unknown server — a malicious server can lie. Use them to improve UX, not as a security boundary.
Return tools from tools/list in deterministic order. This helps client caches and the model's prompt cache work effectively.
Define an outputSchema and return structured content when callers need machine-readable results. This lets the model parse and act on what your tool returns.
Keep tool counts modest. Every tool description consumes prompt tokens on every request. A bloated tool list wastes budget and can confuse the model.
Make writes safe to retry. Accept an idempotency key where a duplicate request would cause harm. This is critical for resilience.
Paginate large lists and tell the model how to fetch the next page. Don't dump 10,000 results in one response.
// A well-formed tool definition (as returned by tools/list)
{
"name": "create_invoice",
"description": "Create a DRAFT invoice for a customer. Does not send it. Returns the invoice id.",
"inputSchema": {
"type": "object",
"properties": {
"customer_id": { "type": "string", "description": "Id from search_customers" },
"amount_cents": { "type": "integer", "minimum": 1 },
"currency": { "type": "string", "enum": ["USD", "EUR", "INR"] }
},
"required": ["customer_id", "amount_cents", "currency"]
},
"annotations": { "readOnlyHint": false, "destructiveHint": false, "idempotentHint": false }
}Notice the description is specific: it says the invoice is a draft and won't be sent. The schema lists required fields and constraints. The annotations are explicit. The model has everything it needs to decide whether to call this tool and what arguments to pass.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.