Skip to main content
Glama

mail_undo_bulk_action

Regret a bulk cleanup? Reverse it within 30 days using the action_id from the original run: moved, archived, or trashed messages return to their folders; marked-read ones become unread.

Instructions

Reverse one earlier mail_run_bulk_action run by its action_id: moved, archived or trashed messages go back to their folder, and messages it marked read become unread.

Use when: the owner regrets a bulk cleanup made within the last 30 days. Not for single moves or deletions (use mail_move_messages to bring messages back from their folder or Trash), or for marking specific messages (use mail_mark_messages). Parameters: action_id is the 12-character hex string from the mail_run_bulk_action result (its undo field repeats it), copied exactly; it is not a uid or a confirm_token. Only runs made on this server within 30 days are found: an unknown, mistyped or expired id returns undone=false with a reason and changes nothing, so check the id rather than retrying. Behavior:

  • Messages are found again by Message-ID in the folder the run left them in (the original folder for mark_read) and handled in chunks.

  • Any moved or deleted since the run are skipped.

  • Undoing mark_read marks every handled message unread, including ones that were already read before the run.

  • Each run can be undone once, and the undo is logged. Returns: {undone: true, restored, of, note when some were skipped}, or {undone: false, reason} when the id is unknown, already undone, or older than 30 days. Errors: 'Could not open the folder' when that folder was renamed or deleted since; the messages then have to be found with mail_search_messages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
action_idYesThe action_id returned by mail_run_bulk_action.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "title": "mail_undo_bulk_actionDictOutput",
      -  "type": "object"
      -}New value: +null
  2. Addedv0.7.0

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations: chunked re-matching by Message-ID, skipping of messages moved/deleted since the run, the notable side effect that undoing mark_read marks even previously-read messages unread, single-undo semantics, logging, the 30-day window, and the error path when a folder was renamed or deleted. None of this is derivable from readOnlyHint/destructiveHint/idempotentHint.

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?

Well front-loaded with Purpose/Use when/Parameters/Behavior/Returns sections, and most sentences carry distinct information. It runs long, with a few explanatory asides (e.g. 'so check the id rather than retrying') that are helpful but not strictly load-bearing.

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?

Complete for a single-parameter undo tool with no output schema: the description documents the return shapes ({undone, restored, of, note} vs {undone, reason}), the failure reasons, and the follow-up path via mail_search_messages.

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 100% and there is only one parameter, yet the description still adds real meaning: 12-character hex format, provenance from the mail_run_bulk_action result and its undo field, the explicit warning that it is neither a uid nor a confirm_token, and expiry behavior on a wrong id.

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?

States a precise verb+resource ('Reverse one earlier mail_run_bulk_action run by its action_id') and immediately enumerates the affected state changes (moved/archived/trashed restored, mark-read reverted). It explicitly distinguishes itself from mail_move_messages and mail_mark_messages.

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?

Gives an explicit when ('the owner regrets a bulk cleanup made within the last 30 days') and explicit when-not clauses with named alternatives (single moves/deletions -> mail_move_messages; specific messages -> mail_mark_messages). No inference required.

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