Skip to content

AAK-MCP-ANNOTATION-MISMATCH-001: A tool annotated read-only or non-destructive changes storage

Severity
MEDIUM
Category
Tool Poisoning (tool-poisoning)
Scanner
agent_audit_kit/scanners/mcp_server_code.py
Auto-fixable
No.
SARIF name
McpToolAnnotationMismatch

What it detects

A tool annotated readOnlyHint=True or destructiveHint=False has a handler that writes, deletes or rewrites storage (open(..., "w"), os.remove, shutil.rmtree, unlink, fs.writeFile, fs.rm, SQL DELETE, UPDATE or DROP). Hosts use these hints to auto-approve, so the tool runs without asking. A tool with no annotations is not a mismatch: absent hints read as the MCP defaults, readOnlyHint false and destructiveHint true, which already say it may write. A read-only annotation on a handler that only reads does not fire.

How to fix

Correct the annotation, or take the write out of the tool. Hints are the server's word, so a client should let its owner override them per tool, and read a missing hint as a possible write.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-ANNOTATION-MISMATCH-001

Limitations

Python: the decorated handler's own calls, so a helper it calls is not followed. readOnlyHint true reports any write, an append or an INSERT too. destructiveHint false alone reports only what overwrites or removes, so an append or an INSERT passes it. SQL is read from the start of a string or f-string passed to execute, executemany or executescript, so a query built first and passed by name is not read, and neither is an ORM's delete. An annotation held in a variable is not read. TypeScript and JavaScript: by pattern, from the hint to the next tool registration, so a handler defined elsewhere and passed by name is not read. A source file over 512 KB is not read.

References

  • OWASP MCP Top 10: MCP03:2025 (Tool Poisoning)
  • OWASP Agentic Top 10: ASI02 (Tool Misuse and Exploitation), ASI09 (Human-Agent Trust Exploitation)
  • Adversa AI MCP Top 25 (AAK-defined ids): ADV-AUTH-01 (Missing Authentication)

All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-ANNOTATION-MISMATCH-001.md: the page then shows that text, with the registry reference appended under it.