What are MCP tool annotations? Behavior hints
By Flavio
MCP tool annotations describe whether a tool reads, changes, or reaches external data. Learn what the hints mean and why servers still need access controls.
MCP tool annotations are metadata that describe a tool’s behavior. They tell a client whether an operation claims to be read-only, destructive, safe to repeat, or open to external interactions.
How to build an MCP server shows annotations on a working blog-search tool, including what the MCP Inspector displays.
How annotations work
The server includes an annotations object in a tool definition. The host can use those hints when presenting or scheduling calls.
The MCP schema defines these fields:
| Field | Meaning when true |
|---|---|
readOnlyHint | The tool does not modify its environment |
destructiveHint | The tool may make destructive updates |
idempotentHint | Repeating the same arguments has no additional effect |
openWorldHint | The tool may interact with an open world of external entities |
The destructive and idempotent hints apply when the tool can modify its environment. A tool can change data and still be idempotent: setting an issue’s status to the same value twice is one example.
In coding tools
Claude Code documents using readOnlyHint and idempotentHint to identify calls it can repeat after a connection closes. It also runs read-only calls alongside other read-only calls.
The MCP connection guides for Codex, Cursor, and Grok Build do not specify equivalent handling of these hints. Connecting a server alone tells you nothing about how its annotations affect approvals or retries.
Details checked against each vendor’s documentation in November 2026.
A concrete example
The search_posts tool in the server-building tutorial reads an in-memory collection of published posts. Its registration includes:
annotations: { readOnlyHint: true, openWorldHint: false }
This is a field inside the tool registration. The handler searches a fixed local collection, so those annotations describe what the code does. The tutorial shows the Inspector’s READ-ONLY badge and the actual search results.
When to use them
Add accurate annotations when building tools. They help a client distinguish a local lookup from an operation that changes data or interacts with external systems.
When reviewing a server, compare its hints with its handler and credentials. A read-only operation should work with read-only access wherever the backing service supports it.
Pitfalls
The tools specification requires clients to treat annotations as untrusted unless the server is trusted. Enforce permissions in the server and backing service.
Safe to repeat and read-only mean different things. A tool that creates another record on every call needs different retry handling from one that sets a fixed value.
Related on flaviocopes.com
- Build an MCP server includes the complete search handler.
- What is MCP? inspects a filesystem server’s real tool definitions.
- Buy a domain with an AI agent and approval shows the approval flow in Cloudflare Domains Toolkit for an operation that spends money.
Related glossary entries
- Tool calling: Tool calling is when a model names a function and its arguments, and the app runs it. How Claude Code, Codex, Cursor and Grok Build take that step.
- Permission modes: Permission modes decide what a coding agent can do without asking. The modes in Claude Code, Codex, Cursor and Grok Build, and what YOLO mode really skips.
- Sandbox: An agent sandbox limits which files and hosts a coding agent's commands can reach. How the boundary works in Claude Code, Codex, Cursor and Grok Build.
Want me to talk about your product? You can sponsor this site.