Skip to content

MCP: tool design

The model decides which tool to call from its name, description, and schema alone. Tool design is prompt engineering, and it matters more than anything else in your server.

  1. Design for tasks, not endpoints. One schedule_meeting tool beats list_users + list_calendars + get_availability + create_event. Fewer calls means fewer chances for the model to go wrong.
  2. Keep the set small. In many clients, every tool’s schema occupies context in every request. Claude Code defers tools through tool search, so not every schema sits in context there, but a small, distinct set still helps any model choose correctly. Aim for under about 10 per server (this guide’s rule of thumb), and combine near-duplicates by adding a parameter.
  3. Return meaningful, concise output. Return human-readable names instead of opaque IDs (or both), and include only the fields the model needs.
  4. Make errors instructive. “Date must be ISO 8601, e.g. 2026-09-29” gets fixed on the next try. “Invalid input” doesn’t.
  5. Be explicit about side effects with annotations and wording.
Rule ✅ ❌
verb_noun, snake_case (this guide’s convention, not a spec rule) search_orders, create_ticket orders, doTicketThing
Namespace when servers might collide jira_search_issues search
Consistent verbs across the server get_ / list_ / search_ / create_ / update_ / delete_ mixing fetch_, get_, and retrieve_
Allowed characters letters, digits, _, and -, 64 characters or fewer spaces, dots

The spec allows A–Z, a–z, 0–9, _, -, and ., up to 128 characters. The spec allows ., but avoid it: the Claude API rejects dots. The 64-character limit is this guide’s rule of thumb, and the bundled smoke script enforces it.

Write them for a smart colleague who has never seen your system. Anthropic recommends at least 3–4 sentences per tool, and more for complex tools:

Search customer orders by email, order number, or date range.
Returns at most 20 orders, newest first, with status and total.
Use get_order for full line items. Dates are ISO 8601 (YYYY-MM-DD).

Include:

  • What it does and what it returns
  • When to use it versus a sibling tool
  • Formats and limits (dates, units, pagination, and maximum results)
  • Side effects (“sends an email to the customer”, “cannot be undone”)
  • Describe every parameter, including its format, units, and an example.
  • Use constraints: enum, minimum/maximum, minLength, pattern, and format: "date".
  • Keep the required parameters minimal and give the rest sensible defaults.
  • Prefer flat objects; deeply nested inputs are error-prone for models.
  • Use unambiguous parameter names: user_id, not user; amount_cents, not amount.
  • Text content that reads well: short lines and labelled fields.
  • Structured content (outputSchema + structuredContent) when a client or a follow-up tool needs to parse it. Include a text version too, for clients that only show text.
  • Truncate and paginate. Cap the result size and return a cursor or a “showing 20 of 312, refine with since” hint. Claude Code warns when a tool’s output exceeds 10,000 tokens and cuts it off at 25,000 by default (users can raise this with the MAX_MCP_OUTPUT_TOKENS environment variable), so don’t rely on large outputs getting through.
  • Resource links for large payloads: return a URI the client can fetch, instead of inlining megabytes.
  • Consider a response_format: "concise" | "detailed" parameter for tools whose output size varies a lot.
Annotation Meaning Default Set it to
title Human-readable display name None (clients show the tool name) Always set it, for example “Search notes”
readOnlyHint Doesn’t modify its environment false true for search, get, and list
destructiveHint May delete or overwrite (only meaningful when not read-only) true false for additive writes such as add_note; leave true for delete, overwrite, and bulk update
idempotentHint Repeating it with the same arguments has no additional effect false true for upserts and “set status to X”
openWorldHint Interacts with external entities (web, third-party APIs) true false for tools that touch only your own closed system (a local file, your own database); leave true for web fetch and sending email

Because destructiveHint and openWorldHint default to true, a tool that omits them is treated as destructive and open-world. Set them to false explicitly where they don’t apply.

Annotations are hints. Clients use them for approval UX, but they don’t enforce security. Real protection belongs in your server (see Security).

Situation Return
Bad input the model can fix isError: true + what’s wrong + a valid example
Not found isError: true + a suggestion (“No order 123. Use search_orders to find the number.”)
Permission denied isError: true + what access is needed (never leak secrets)
Upstream outage or timeout isError: true + “temporary, retry in N s”
Bug in your server Let it throw. The SDK returns an error; log the details to stderr

Keep secrets out of error messages. In TypeScript, a thrown exception’s message reaches the model; in Python, a ToolError message does. Never put tokens, connection strings, internal hostnames, or stack traces in them. Log those to stderr instead.

  • Total tool count per server is under about 10 (this guide’s rule of thumb), or the extras are split into optional servers
  • Descriptions are complete (at least 3–4 sentences) but not padded
  • Default result limits are small (5–20, this guide’s rule of thumb)
  • Outputs stay well under Claude Code’s 10,000-token warning
  • No raw HTML or huge JSON blobs in outputs
  • Large data is returned as resource links or paginated

A skill can teach the agent how to use your server well: which tool to use first, common workflows, and gotchas. This keeps tool descriptions focused, while complex guidance loads only when it’s relevant. See Skills concepts (the “integration skill” archetype).