Tool Design for Agents
Tools designed for agents differ fundamentally from APIs designed for developers. A developer reads documentation and understands underlying systems. An agent infers intent from descriptions and generates calls from natural language. Every ambiguity is a failure mode.The Dual Audience Problem
Tool errors serve two audiences with opposite needs:- Developers: detailed technical info, stack traces, internal state
- Agents: actionable guidance — what went wrong and exactly how to correct it
Description Engineering
Every tool description must answer four questions:- What does the tool do? — exact action, not vague (“helps with”, “can be used for”)
- When should it be used? — specific triggers and contexts, including indirect signals
- What inputs does it accept? — types, constraints, defaults, what each parameter controls
- What does it return? — output format, examples of success and error states
Error Message Structure
Error messages for agents should contain:- What specifically went wrong (not just an error code)
- What the correct format or value should be
- A concrete example of valid input
- Whether a retry is appropriate
{"error": "400 Bad Request"} — that gives the agent nothing to act on.
Naming Conventions
Parameters: self-documenting full words, no abbreviations except standard ones (id, url). Consistent across all tools for similar concepts.- Good:
customer_id,search_query,output_format,max_results - Bad:
x,val,param1,info
- Affirmative options:
include_prefix (include_history,include_metadata) - Negative options:
exclude_prefix (exclude_archived,exclude_inactive) - Don’t mix:
"format": "short"in one tool and"format": "brief"in another for the same concept
Response Format
Provide format options that let agents request appropriate verbosity:Tool Discovery
Agents discover tools by scanning descriptions. A tool that matches many ambiguous situations gets called incorrectly. Design each tool to have a clear, non-overlapping trigger condition. When two tools could plausibly be used for the same thing, one of them is named wrong, described wrong, or shouldn’t exist.Application to This Codebase
When writing tools for Claude agents (MCP tools, harness tools, bash wrappers):- Write the description as if the agent has never seen the codebase
- Put the correction instruction directly in the error message
- Choose parameter names that appear in the natural language query that would trigger the tool
- Test by asking: “If the agent calls this with wrong input, does the error tell it exactly what to change?”
Related Pages
- Agent Harness — harness architecture where tools live; bash as general-purpose tool