MCP Tool Annotations Explained: Practical Examples, Defaults, and Security Best Practices
Understand MCP Tool Annotations and how they influence AI agent interactions with tools. Learn the four core annotations — readOnlyHint, destructiveHint, idempotentHint, and openWorldHint — with practical JSON examples, default behaviors, security considerations, common mistakes, and testing strategies for building reliable Model Context Protocol servers.
On this page
- 1. What Are MCP Tool Annotations?
- 2. The Four Core MCP Tool Annotations Explained
- 2.1 readOnlyHint
- 2.2 destructiveHint
- 2.3 idempotentHint
- 2.4 openWorldHint
- 3. MCP Tool Annotation Defaults Explained
- 4. Practical MCP Tool Annotation Examples
- 5. Understanding Annotation Combinations
- 6. MCP Tool Annotations Are Not Security Controls
- 7. Common Mistakes When Implementing MCP Annotations
- 8. How to Test MCP Tool Annotations
- MCP Annotation Verification Checklist
- 9. Frequently Asked Questions
- What are MCP Tool Annotations?
- What are the four MCP Tool Annotations?
- What happens when MCP Tool Annotations are missing?
- Is readOnlyHint a security guarantee?
- Can a read-only MCP tool have openWorldHint set to true?
- Why is idempotentHint important?
- Do all MCP clients use annotations in the same way?
- Conclusion
MCP Tool Annotations Explained: Practical Examples, Defaults, and Security Best Practices
Model Context Protocol (MCP) allows AI applications to interact with external tools, services, and data sources through a standardized interface. But when an AI agent discovers an MCP tool, knowing its name and description is not always enough.
Does the tool only read information? Can it delete files? Does it modify external systems? Is it safe to call repeatedly with the same arguments?
This is where MCP Tool Annotations become important.
Tool annotations provide additional information about a tool's expected behavior, helping MCP clients understand its operational characteristics and make better decisions about tool interactions.
In this guide, we'll explore the four core behavioral hints, their default values, practical JSON examples, common implementation mistakes, and the security considerations developers should understand when building MCP servers.
1. What Are MCP Tool Annotations?#
MCP Tool Annotations are optional metadata attached to tool definitions. They describe certain behavioral characteristics of a tool, giving clients additional context about what the tool may do.
The MCP specification defines four core behavioral hints:
readOnlyHintdestructiveHintidempotentHintopenWorldHint
There is also an optional title property that provides a human-readable tool title.
For example, consider an MCP server that exposes these tools:
| Tool | Expected behavior |
|---|---|
read_file | Reads a file |
delete_file | Deletes a file |
create_github_issue | Creates an external issue |
search_web | Searches public information |
update_database | Modifies database records |
Although all five are MCP tools, their operational risks are different.
Annotations help communicate these differences to clients.
Importantly, annotations are hints, not security guarantees. The MCP specification explicitly warns that clients should not make tool-use decisions based on annotations received from untrusted servers.
2. The Four Core MCP Tool Annotations Explained#
Let's understand each annotation through its definition and practical applications.
2.1 readOnlyHint#
readOnlyHint indicates whether a tool modifies its environment.
true: The tool does not modify its environment.false: The tool may modify its environment.
Default: false
Example:
A tool that retrieves the contents of a local file can be marked read-only.
{
"name": "read_file",
"description": "Read the contents of a file",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string"
}
},
"required": ["path"]
},
"annotations": {
"readOnlyHint": true
}
}
This tells the client that the tool is intended to retrieve information without modifying the environment.
Now consider a file deletion tool:
{
"name": "delete_file",
"description": "Delete a file from the filesystem",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string"
}
},
"required": ["path"]
},
"annotations": {
"readOnlyHint": false
}
}
This tool modifies the filesystem, so it should not be described as read-only.
Practical rule: If a tool creates, updates, deletes, or otherwise changes its environment, don't mark it as read-only.
2.2 destructiveHint#
destructiveHint indicates whether a tool may perform destructive updates to its environment.
true: The tool may perform destructive updates.false: The tool performs only additive updates.
Default: true
This annotation is meaningful only when readOnlyHint is false.
Consider two tools:
Example A: Creating a GitHub issue
Creating an issue adds a new resource without deleting or overwriting existing resources.
{
"annotations": {
"readOnlyHint": false,
"destructiveHint": false
}
}
Example B: Deleting a database record
Deleting a database record removes existing data.
{
"annotations": {
"readOnlyHint": false,
"destructiveHint": true
}
}
The distinction matters because not every operation that modifies an environment is necessarily destructive.
Creating a new resource is generally additive, whereas deleting or overwriting existing resources may be destructive.
Practical rule: Evaluate what happens to existing resources, not simply whether the tool performs a write operation.
2.3 idempotentHint#
idempotentHint describes whether repeatedly calling a tool with the same arguments produces additional effects on the environment.
true: Repeated calls with identical arguments have no additional effect on the environment.false: Repeated calls may produce additional effects.
Default: false
Consider a tool that sets a user's account status to active.
{
"annotations": {
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": true
}
}
Calling this operation multiple times with the same user ID and status should leave the account in the same state.
Now consider a tool that creates a new payment transaction.
{
"annotations": {
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": false
}
}
Calling the same operation repeatedly may create multiple transactions.
This is why it should not automatically be marked idempotent.
An important distinction: idempotency concerns the resulting environment, not whether repeated calls return identical responses.
For example, a deletion operation can be idempotent if repeating it does not produce additional state changes, even if the second call returns a different response because the file is already missing.
Practical rule: Mark a tool idempotent only when its implementation actually guarantees that repeating the same operation does not create additional environmental effects.
2.4 openWorldHint#
openWorldHint indicates whether a tool may interact with an open world of external entities.
true: The tool may interact with external entities.false: The tool operates within a closed domain.
Default: true
Consider a public web search tool:
{
"annotations": {
"readOnlyHint": true,
"openWorldHint": true
}
}
It does not modify its environment, but it retrieves information from the public internet.
Now consider a tool that searches a fixed, private documentation collection:
{
"annotations": {
"readOnlyHint": true,
"openWorldHint": false
}
}
Its interaction domain is restricted to a known collection rather than an open set of external entities.
This distinction is important because information retrieved from external sources may contain untrusted content.
A read-only tool can still interact with an open world. These annotations describe different properties.
Practical rule: Think about the tool's interaction domain, not simply whether it accesses a remote server.
3. MCP Tool Annotation Defaults Explained#
One of the most important details in the MCP specification is that annotations have default values.
If a property is omitted, its specified default applies.
| Annotation | Default | Meaning |
|---|---|---|
readOnlyHint | false | Assume the tool may modify its environment |
destructiveHint | true | Assume potentially destructive updates |
idempotentHint | false | Do not assume repeated calls are safe |
openWorldHint | true | Assume possible interaction with external entities |
Notice that these defaults are deliberately conservative.
For example, a tool definition without annotations does not automatically become read-only.
This is particularly important when building MCP servers with many tools. Developers should explicitly declare accurate annotations instead of relying on defaults to describe intended behavior.
Also remember that destructiveHint and idempotentHint are meaningful only when readOnlyHint is false.
4. Practical MCP Tool Annotation Examples#
Let's apply these concepts to common MCP server operations.
The following examples show recommended annotations based on the stated behavior. Actual values must always reflect the implementation.
| Tool | readOnly | destructive | idempotent | openWorld |
|---|---|---|---|---|
read_file | true | N/A | N/A | false |
delete_file | false | true | true* | false |
create_github_issue | false | false | false | true |
search_web | true | N/A | N/A | true |
set_user_status | false | false | true | false |
increment_counter | false | false | false | false |
N/A means the hint is not meaningful when the tool is read-only. The delete operation is marked idempotent only if repeating the same deletion does not create additional state changes.
Here is a complete example of an MCP tool definition:
{
"name": "create_github_issue",
"description": "Create a new issue in a GitHub repository",
"inputSchema": {
"type": "object",
"properties": {
"owner": {
"type": "string"
},
"repo": {
"type": "string"
},
"title": {
"type": "string"
},
"body": {
"type": "string"
}
},
"required": [
"owner",
"repo",
"title"
]
},
"annotations": {
"title": "Create GitHub Issue",
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": true
}
}
This example communicates that the tool creates an external resource, does not simply retrieve information, and may create additional issues if called repeatedly.
5. Understanding Annotation Combinations#
Annotations are independent behavioral hints. Their combinations provide a more complete description of a tool.
Consider these scenarios:
Scenario 1: Read-only + Open-world
A public web search tool retrieves information without modifying its environment.
{
"readOnlyHint": true,
"openWorldHint": true
}
Scenario 2: Read-only + Closed-world
A tool searches a fixed internal knowledge base.
{
"readOnlyHint": true,
"openWorldHint": false
}
Scenario 3: Additive + Idempotent
A tool ensures that a particular configuration exists without creating duplicate state.
{
"readOnlyHint": false,
"destructiveHint": false,
"idempotentHint": true
}
Scenario 4: Destructive + Non-idempotent
A tool increments a counter or performs an operation that produces a new effect on every invocation.
{
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false
}
The final example would apply only if the operation genuinely makes destructive changes. An increment operation that only adds to a counter would instead use destructiveHint: false.
The key lesson is that developers should evaluate each behavioral property independently rather than assigning annotations based on tool names.
6. MCP Tool Annotations Are Not Security Controls#
This is probably the most important concept developers should understand.
Annotations describe expected behavior. They do not enforce permissions, validate operations, or prevent unauthorized access.
Imagine an MCP server exposes this tool:
{
"name": "delete_database",
"description": "Delete database records",
"annotations": {
"readOnlyHint": true,
"destructiveHint": false
}
}
The annotations incorrectly describe the tool's behavior.
A client that trusts this declaration could misunderstand the operational risk.
The MCP specification explicitly warns that annotations received from untrusted servers should not be used as the basis for tool-use decisions.
Actual security must be implemented separately.
A secure MCP server should include:
- Authentication and authorization.
- Server-side permission checks.
- Input validation.
- Explicit approval for sensitive operations where appropriate.
- Audit logging.
- Restricted access to files, databases, and external services.
For example, a database deletion tool should enforce authorization inside its execution logic, regardless of what its annotations declare.
Remember: An annotation can describe a permission boundary, but it cannot enforce one.
For more guidance, see the official MCP Tool Annotations discussion and OpenAI's MCP documentation.
7. Common Mistakes When Implementing MCP Annotations#
Developers frequently make mistakes when assigning behavioral hints.
Here are some worth avoiding.
Mistake 1: Marking every tool as read-only
Not all tools retrieve information. File operations, database updates, and deployment tools may modify their environments.
Mistake 2: Treating every write as destructive
Creating a new GitHub issue is an additive operation. It modifies the environment, but does not necessarily destroy existing resources.
Mistake 3: Marking every repeated operation as idempotent
Calling a payment creation tool twice can create two transactions. Repeated calls must be evaluated based on their actual effects.
Mistake 4: Confusing remote access with open-world access
A remote service is not automatically open-world. A bounded private workspace may still have a closed interaction domain.
Mistake 5: Treating annotations as authorization
Never depend on readOnlyHint or destructiveHint to protect sensitive operations. Enforce permissions on the server.
Mistake 6: Relying on defaults without understanding them
Omitting annotations does not communicate that a tool is safe. MCP defines conservative defaults for missing hints.
8. How to Test MCP Tool Annotations#
Writing annotations is only part of implementation. Developers should also verify that the declarations accurately represent actual tool behavior.
A practical verification process can include the following steps.
Step 1: Inspect the tool definition
Use the MCP tools/list request to retrieve the server's available tool definitions and inspect their annotations.
Step 2: Compare declarations with implementation
Check whether the actual execution logic matches each annotation.
For example, if readOnlyHint is true, verify that the tool does not modify files, database records, or other environmental state.
Step 3: Test repeated calls
For tools marked idempotent, invoke them repeatedly with identical arguments and compare the resulting environment state.
Step 4: Test destructive behavior
For destructive operations, use a controlled test environment and verify what resources are modified, overwritten, or removed.
Step 5: Verify external interactions
Determine whether the tool accesses public services, external repositories, or other open-world entities.
Step 6: Test security independently
Verify that unauthorized requests are rejected even if the tool advertises itself as read-only or non-destructive.
MCP Annotation Verification Checklist#
- Every tool has been reviewed for accurate behavioral annotations.
- Read-only tools do not modify their environment.
- Destructive operations are correctly identified.
- Idempotency has been tested through repeated calls.
- Open-world behavior reflects the actual interaction domain.
- Missing annotation defaults are understood.
- Server-side permissions are enforced independently.
- Sensitive operations are tested in a controlled environment.
9. Frequently Asked Questions#
What are MCP Tool Annotations?#
MCP Tool Annotations are optional metadata that describe behavioral characteristics of MCP tools, including whether they modify their environment, perform destructive updates, behave idempotently, or interact with external entities.
What are the four MCP Tool Annotations?#
The four behavioral hints are readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. MCP also supports an optional title property.
What happens when MCP Tool Annotations are missing?#
The specification defines conservative defaults: readOnlyHint is false, destructiveHint is true, idempotentHint is false, and openWorldHint is true.
Is readOnlyHint a security guarantee?#
No. It is a behavioral hint, not an authorization mechanism. MCP servers must enforce their own permissions and security policies.
Can a read-only MCP tool have openWorldHint set to true?#
Yes. A public web search tool can retrieve external information without modifying its environment. Read-only behavior and open-world interaction describe different properties.
Why is idempotentHint important?#
It helps communicate whether repeated calls with identical arguments produce additional effects. This is particularly useful when designing reliable tool interactions and handling retries.
Do all MCP clients use annotations in the same way?#
No. Annotations provide metadata, but clients may interpret or present them differently. Developers should not assume that every client enforces the same approval, retry, or security behavior.
Conclusion#
MCP Tool Annotations provide a useful vocabulary for describing how AI agents interact with tools.
By understanding readOnlyHint, destructiveHint, idempotentHint, and openWorldHint, developers can create clearer tool definitions and provide MCP clients with more meaningful behavioral context.
However, accurate annotations are only one part of reliable MCP development.
A well-designed server must combine accurate metadata with server-side authorization, input validation, controlled execution, and independent security checks.
As AI agents become more capable of interacting with filesystems, databases, APIs, and deployment environments, describing tool behavior accurately becomes increasingly important.
The goal is not simply to expose tools to AI agents. It is to make their behavior understandable, predictable, and safe to work with.
Get new posts by email
High-signal notes on AI, automation and building systems. No spam.