NEWn1n v2.0.1 is live! Enterprise Unified LLM API Gateway with 500+ AI Models, up to 90% off, Try now

Mastering MCP Tool Annotations: Why Defaulting to Destructive Matters

Authors
  • avatar
    Name
    Nino
    Occupation
    Senior Tech Editor

The rise of the Model Context Protocol (MCP) has fundamentally changed how developers connect Large Language Models (LLMs) like Claude 3.5 Sonnet and GPT-4o to external data and tools. However, as we discovered while building IndexCyborg—an automation tool for website indexing—submitting a remote MCP server to major directories like the Claude connector or ChatGPT app directory requires more than just functional code. The real challenge lies in the metadata: the tool annotations.

When deploying high-performance AI agents through aggregators like n1n.ai, understanding these annotations is critical for both security and user experience. If you leave these fields blank, the system assumes the worst-case scenario, often labeling your tools as "destructive" by default.

The MCP Annotation Schema: Understanding the Defaults

Every tool in an MCP server can carry specific hints next to its name and schema. These hints inform the client (Claude or ChatGPT) about the behavior of the tool before it is executed. According to the MCP specification, there are four primary booleans:

  1. readOnlyHint: Indicates the tool does not modify its environment. (Default: false)
  2. destructiveHint: Indicates the tool may perform destructive updates. (Default: true)
  3. idempotentHint: Indicates that calling the tool multiple times with the same arguments has no additional effect. (Default: false)
  4. openWorldHint: Indicates the tool interacts with external entities outside the immediate server environment. (Default: true)

If you ignore these, a simple list_pages tool is treated as a destructive, non-idempotent operation that modifies the environment. This leads to "Confirmation Fatigue," where users are prompted to "Allow" every single action, eventually leading them to click through without reading—a significant security risk.

Server-Side Enforcement vs. Client-Side Hints

It is vital to remember that annotations are for the User Experience (UX) and the review process, not for actual security. A malicious client could ignore a destructiveHint. Therefore, robust implementation requires server-side validation. At IndexCyborg, we use a wrapper to ensure that every tool call is authorized based on the caller's scope before the logic executes.

For developers using n1n.ai to access multiple LLMs via a single API, this multi-layered approach ensures that even if one model misinterprets a tool hint, the server remains secure.

const run: ToolRunner = async (scope, fn) => {
  const denied = requireScope(scope);
  if (denied) return denied;
  try {
    return await fn();
  } catch (err) {
    if (err instanceof ServiceError) return toolError(err.message, err.code);
    console.error("MCP tool error:", err);
    return toolError("Unexpected error.");
  }
};

Implementation Strategy: Using Presets

With 36 different tools in our MCP server, manually defining four booleans for each tool is prone to error. We developed a set of named presets to ensure consistency. During the ChatGPT app review, we found that the reviewers specifically looked for readOnlyHint, destructiveHint, and openWorldHint to be explicitly defined as booleans, rather than relying on defaults.

// Explicit presets for MCP tools
export const READS = { 
  readOnlyHint: true, 
  destructiveHint: false, 
  openWorldHint: false 
} as const;

export const WRITES = { 
  readOnlyHint: false, 
  destructiveHint: false, 
  openWorldHint: false 
} as const;

export const WRITES_EXTERNAL = { 
  ...WRITES, 
  openWorldHint: true 
} as const;

export const DESTRUCTIVE = { 
  readOnlyHint: false, 
  destructiveHint: true, 
  openWorldHint: false 
} as const;

The "Open World" Trap: A Lesson from ChatGPT's Scan

One of the most nuanced aspects of MCP annotations is the openWorldHint. Initially, we only marked tools as open-world if they reached out to third-party APIs like Stripe or Google. We considered tools that fetched the user's own website (sitemaps or HTML) as "closed" because the user owns the site.

ChatGPT's automated scan flagged this. The reasoning is subtle but important: an "open world" isn't defined by ownership, but by control. A user's website is often managed by a CMS, a hosting provider, or could even be compromised. Its content is untrusted data. Any tool that reads from the public internet must be marked as openWorldHint: true so the LLM can treat the output with the appropriate level of suspicion (e.g., to prevent prompt injection via web content).

Best Practices for MCP Tool Development

To ensure your tools pass review and provide a seamless experience for users on platforms like n1n.ai, follow these guidelines:

  1. Granularity: Avoid "Swiss Army Knife" tools. One tool should perform one specific action. Instead of a generic api_request tool, use get_user_data and update_user_profile.
  2. Naming Limits: Keep tool names under 64 characters to ensure compatibility across all MCP clients.
  3. Title Duplication: MCP allows titles in two places: the top-level title and annotations.title. Claude's directory specifically looks at the latter. Automate the copying of these titles to avoid drift.
  4. Testing the Hints: Don't just unit test the logic. Use a real MCP client to list your tools and verify that all hints are present and correctly typed as booleans.
it("should set every annotation hint explicitly", async () => {
  const client = await connect(["read"]);
  const { tools } = await client.listTools();
  for (const tool of tools) {
    expect(typeof tool.annotations?.readOnlyHint).toBe("boolean");
    expect(typeof tool.annotations?.destructiveHint).toBe("boolean");
    expect(typeof tool.annotations?.openWorldHint).toBe("boolean");
  }
});

By carefully managing these annotations, you transition from a "dangerous" default state to a professional, high-trust integration. This level of detail is what separates hobbyist projects from enterprise-ready AI agents.

Get a free API key at n1n.ai