MCP Server Design · ~7 min
A well-designed tool makes the correct call obvious. A poor one burns tokens on retries, confuses routing, and forces blind debugging. Three levers: the name, the schema, the error.
You've chosen the primitive (Lesson 1) and decided to expose data on demand (Lesson 2). Now you design the individual tool so the agent picks it, calls it right the first time, and recovers without a human when it doesn't.
The spec allows 1–128 characters from A-Z a-z 0-9 _ - . with no spaces. The conventions that work in
practice:
search_customer_orders, not query_db_orders.search_products, not prod_lookup_v2.inputSchema must be valid JSON Schema. But the schema defines types and constraints, not usage
— so pair it with prose and examples. In Anthropic's tests, 1–5 realistic examples in the description raised tool-use
accuracy from 72% to 90%.
Enums kill guesswork, defaults handle the common case, descriptions pair each constraint with an example, and
negative guidance (“do NOT use for metrics”) stops misrouting before it happens. Set
additionalProperties: false so unexpected fields fail loudly instead of silently.
MCP has two error channels, and mixing them up is a common mistake. Protocol errors (JSON-RPC
codes) are for the client — malformed requests, missing methods. Tool execution errors
(isError: true in the result) are for the agent, and the spec is explicit that they should carry
“actionable feedback that language models can use to self-correct and retry.”
| Error message | Agent can self-correct? |
|---|---|
"Error" | No |
"Invalid date format" | Maybe |
"Invalid departure date: must be in the future. Current date is 2026-03-13." | Yes |
Include what was wrong, the constraint, and the context to fix it. That's the poka-yoke principle applied to errors: eliminate the guesswork that drives retry loops.
An enum encodes a snapshot. When the upstream API adds a value, agents hit validation failures until
you redeploy. For fast-churning upstreams, a thin string type trades strict validation for durability.
Use enums where the value set is genuinely stable.
additionalProperties: false to remove guesswork.Retrieval practice — recall, don't peek
Question 1The naming convention used by most public MCP servers is…
Question 2Adding 1–5 realistic examples to a tool description raised accuracy from…
Question 3An error with isError: true in the result is meant for…
Question 4"Do NOT use for metrics — use query_metrics" is an example of…
Question 5 · spaced recall from Lesson 2Just-in-time retrieval pays off only when the returned chunk is…