Skip to main content
Glama

Undo a logged mailbox change

undo_action
Destructive

Reverses a single logged mailbox change on request, such as a move, read-state, label, or folder-rule action, and reports messages that cannot be restored.

Instructions

Reverse one logged mailbox change, once, at the user's request; reports messages it can no longer restore.

Use it only when the user asks to undo. It reverses a move to Trash, Archive or a folder, a read-state or label change, or a chunk of a folder rules run, by the log_id that call returned (one per log_ids entry) or list_actions finds. It takes no preview or token, and is audited. Draft deletion, unsubscribe, sending, folder creation, saved rules, reindex and preview records cannot be undone.

A large chunk may need several calls: partial=true with "Undo time budget reached" (and deferred, the messages not yet examined) means call again with the same original log_id; each call restores only messages not yet restored, and a finished undo refuses as already undone.

Returns this attempt's own log_id, count, messages, missing and partial, with deferred, unresolved (rows of prior attempts, by their log_id) and error when they apply. An unknown or non-undoable log_id refuses, and so does a chunk over 200 messages.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "log_id": "<log_id>"
    },
    "name": "undo_action"
  }
}

Input Schema

NameRequiredDescriptionDefault
log_idYesThe original action's log_id, 32 lowercase hexadecimal characters, from its result or list_actions.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

The annotations already declare destructive=true and idempotentHint=false, but the description adds meaningful nuance the annotations cannot express: it is audited, needs no preview or token, and is non-idempotent in a specific way (each call restores only messages not yet restored, and a finished undo refuses as already undone). It also discloses time-budget behavior, the deferred/unresolved outputs, and refusal conditions including the 200-message chunk limit.

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?

The opening sentence front-loads the action and the usage restriction follows immediately, with no filler sentences. It is dense with parenthetical asides ("and deferred, the messages not yet examined") that make the retry rule harder to parse than necessary, but essentially every clause carries information an agent needs.

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?

For a one-parameter destructive mutation, the description covers trigger condition, exclusions, retry/partial-completion protocol, refusal cases, and the return fields (log_id, count, messages, missing, partial, deferred, unresolved, error) even though an output schema exists. Nothing an agent needs to call it correctly or interpret a refusal is missing, apart from the stray partial=true reference.

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

Parameters3/5

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

Schema coverage is 100%, so log_id's format (32 lowercase hex) is already documented; the description does add real provenance meaning by tying it to the originating action's result or list_actions, and clarifying that a log_ids list yields one log_id per entry. However, it also tells the agent to call with "partial=true", a parameter that does not exist in the schema (additionalProperties=false), which could lead an agent to send an invalid argument.

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?

"Reverse one logged mailbox change, once, at the user's request" is a specific verb plus resource plus cardinality constraint, and the following sentences enumerate exactly which action types are reversible (move to Trash/Archive/folder, read-state, label, folder rules chunk). It is clearly distinguishable from list_actions and preview_action, which the description names directly.

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?

"Use it only when the user asks to undo" is an explicit trigger condition, and the description supplies the required input source (the log_id returned by the original call, one per log_ids entry, or from list_actions). It also gives an explicit when-not list: draft deletion, unsubscribe, sending, folder creation, saved rules, reindex and preview records cannot be undone.

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