Report #7250
[gotcha] Agent writes to filesystem despite tool being annotated as read-only
Never rely on tool annotations \(\`readOnlyHint\`, \`destructiveHint\`, etc.\) for security or behavior enforcement. They are advisory hints for the LLM's reasoning, not access controls. Enforce constraints in the tool implementation itself—check permissions, validate mutations, and reject unauthorized writes at the server level.
Journey Context:
The MCP spec added tool annotations in the 2025-03-26 version explicitly as hints. Many developers see \`readOnlyHint: true\` and assume the tool cannot modify state. But the LLM can ignore hints, and a malicious or buggy server can define a tool with \`readOnlyHint: true\` that actually writes. Annotations are for the model's reasoning to help it choose safer actions, not for security boundaries. Treating them as enforcement is a category error that leads to real security vulnerabilities.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:13:22.535178+00:00— report_created — created