Searching for mcp tool annotations usually means you already list tools and now need honest metadata for hosts and models: which calls are read-only, which can destroy data, which are safe to retry, and which reach the open world. Short answer—mark annotations to match real side effects; never treat a hint as a substitute for server-side authz or validation. This page deepens the MCP server tutorial and best practices—not a second intro, not an official spec mirror.

01

Independence note

02

What tool annotations are for

Tool annotations are optional metadata attached to a tool definition so clients can warn humans, prefer safer tools, or filter catalogs. They describe intent and risk shape, not a runtime capability check. Your handler still validates arguments, authorizes the caller, and enforces timeouts—same bar as resources vs tools and the ops checklist in best practices.

  • For hosts: confirmation dialogs, read-only modes, audit labels.
  • For models: priors about which tool to try first under context pressure.
  • Not for: replacing authn/authz, rate limits, or idempotency keys.

03

The four common hints (names may evolve)

HintRough meaningMark when…
readOnlyHintCall does not change durable stateTrue read / fetch / search with no writes, emails, or charges
destructiveHintCall can delete or irreversibly alter dataDeletes, drop, revoke, overwrite-without-backup paths
idempotentHintRetrying with the same args is safeCreates/updates keyed so a second call does not double-apply
openWorldHintCall reaches outside your trust boundaryHTTP to arbitrary URLs, third-party APIs, user-supplied hosts

Exact boolean defaults and nesting under annotations differ by SDK generation—confirm the schema you publish. Illustrative shape:

{
  "name": "search_notes",
  "description": "Search project notes by keyword",
  "inputSchema": { "type": "object", "properties": { "q": { "type": "string" } }, "required": ["q"] },
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": false
  }
}

04

When to mark which

  1. Pure reads. Catalogs, docs fetch, status probes—readOnlyHint: true. If the “read” quietly sends email, do not lie; fix the design (see anti-patterns on resources vs tools).
  2. Deletes and revokes. MarkdestructiveHint and prefer elicitation or an explicit human confirm for high-blast actions—see sampling vs elicitation.
  3. Creates/updates. Prefer natural keys or client idempotency tokens so you can honestly setidempotentHint. If a retry doubles a charge, leave it false and document that.
  4. Outbound network. Any tool that follows user-supplied URLs or calls third parties should setopenWorldHint and still enforce allowlists / SSRF guards server-side.

05

Hints ≠ guarantees

  • Keep annotation truth aligned with handler behavior in the same PR.
  • Do not mark read-only to “reduce friction” on a mutating tool.
  • Pair destructive tools with clear descriptions and confirm flows.
  • Re-audit annotations when you add side effects to an old tool name.

07

FAQ

What are MCP tool annotations?

Optional metadata on a tool definition (commonlyreadOnlyHint, destructiveHint,idempotentHint, openWorldHint) that describes risk and side-effect shape for hosts and models. They are advisory—not a substitute for server-side validation and authorization.

When should I set readOnlyHint vs destructiveHint?

Set readOnlyHint only when the call cannot change durable state. Set destructiveHint when the call can delete or irreversibly alter data. A tool cannot honestly be both a pure read and destructive—fix the design or the labels.

Do tool annotation hints guarantee safety?

No. Hints ≠ guarantees. Clients may ignore them; attackers may mislabel tools. Enforce authz, timeouts, and allowlists on the server regardless of annotation values.

Is this official MCP documentation?

No. Unofficial engineering notes from 墨码 / codemo.fun. Spec text, SEPs, and SDK guides remain authoritative—re-check after upgrades.