MCP · MCP0002

Declare whether an MCP tool reads or changes data

Report MCP tools whose annotations set neither `readOnlyHint` nor `destructiveHint` to true.
MCP0002vite-doctor/mcptoolswarnSuggestion

Run this rule

pnpm vite-doctor . --rules mcp/tools/require-safety-hint

Why it matters

Clients decide from these hints whether a tool may run without asking. MCP's defaults are readOnlyHint: false and destructiveHint: true, so a tool that declares neither is treated as one that may destroy data. Claude prompts before every call to such a tool, and Anthropic's Connectors Directory flags it at submission.

Set readOnlyHint: true on a tool that only reads, or destructiveHint: true on one that changes or deletes data.

Example

Mark a read-only tool

Before

export default defineMcpTool({
  name: 'list_drops',
  title: 'List drops',
  annotations: { title: 'List drops' },
  handler: () => listDrops(),
})

After

export default defineMcpTool({
  name: 'list_drops',
  title: 'List drops',
  annotations: { title: 'List drops', readOnlyHint: true },
  handler: () => listDrops(),
})
Copyright © 2026