Skip to main content
Glama

mail_undo

Destructive

Undo a recoverable Mail move by receipt ID: preview which messages will be restored, then confirm to move each back to its original mailbox.

Instructions

Undo one recoverable Mail operation by its receipt id (from move_mail's result, or from audit). A move is undone by moving the messages back to the exact mailbox each came from — recorded per message before the original ran.

dry_run DEFAULTS TO TRUE: preview which messages would be restored, then pass dry_run=False. The undo is itself backed up, logged and verified, and returns its own receipt — so an undo can be undone. A receipt for an operation with no destination mailbox cannot be replayed; the error names the directory holding the preserved message bytes for manual re-import. Undoing a batch moved into a mailbox that already held pre-existing copies of the same Message-ID moves those copies back too — the by-ID act moves every copy of a Message-ID, and undo is an ordinary move. A receipt whose targets recorded unknown (a timeout mid-act) is replayed the same as ok. A move into a Gmail label folder or a unified mailbox name cannot be replayed; the error names the source folder and how to restore by hand. Destructive (it moves mail); needs Automation access for Mail and Full Disk Access.

Input Schema

NameRequiredDescriptionDefault
dry_runNo
receiptYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.1

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare destructiveHint=true, and the description adds substantial context beyond that: the undo is itself backed up, logged, verified, and yields its own receipt (an undo can be undone); it discloses permissions required (Automation for Mail, Full Disk Access) and multiple failure modes with recovery guidance. This is unusually rich disclosure for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the verb and identifier, then proceeds in escalating edge cases. The batch Message-ID caveat is dense but material; a couple of sentences (e.g., the 'unknown' timeout replay) could be tightened, keeping this below a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return shape needn't be described, yet the description still notes that the call returns its own receipt. Combined with the dry-run workflow, permission requirements, and named failure modes, nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description carries the full burden, and it does: 'receipt' is defined via its producers (move_mail result, audit), and 'dry_run' has its default, purpose (preview which messages would be restored), and override instruction spelled out. No ambiguity remains for either parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ('Undo one recoverable Mail operation') and names the identifier source ('receipt' from move_mail's result or from audit). An agent can immediately tell this apart from move_mail, trash_mail, and audit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States exactly where to obtain the receipt, warns that dry_run defaults to true and must be set to False to act, and enumerates the cases where undo cannot be replayed (no destination mailbox, Gmail label folder, unified mailbox name). The routing to move_mail as the producer of the receipt is explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.