Skip to main content
Glama

mail_run_bulk_action

Move, archive, trash, or mark read all messages in an iCloud Mail folder matching filters. Preview the matches first, confirm to run, and undo within 30 days.

Instructions

Move, archive, trash or mark read every message in one folder that matches filters, in two steps (preview, then confirmed run) with a 30-day undo.

Use when: the owner wants a cleanup such as 'archive everything from news@example.org before March'. Not for a few known messages (use mail_move_messages, mail_delete_messages or mail_mark_messages), for flagging or marking unread (use mail_mark_messages), or for stopping future mail (use mail_unsubscribe_from_list). Parameters:

  • At least one filter (from_address, subject, text, since, before, unread) is required; filters combine with AND.

  • from_address, subject and text match substrings; text covers headers and body. since is inclusive, before exclusive.

  • destination is required for move and ignored otherwise; archive and trash use the special folders.

  • max_messages is clamped to 1..1000 and takes the newest matches.

  • The dry_run=false call must repeat the preview's folder, action, destination, filters and max_messages, plus its confirm_token. Behavior:

  • The dry run changes nothing. Show the owner the count and sample and run only on their yes.

  • The token is valid 15 minutes, until the server restarts, and only for exactly the previewed messages: if the matching set changed (new mail, other filters), the run is refused and you preview again.

  • Messages without a Message-ID are left alone and counted.

  • Each run is logged before it starts and can be reversed with mail_undo_bulk_action.

  • Nothing is deleted permanently: trash on Trash, and a destination equal to the source, are refused.

  • MAIL_MAX_AGE_DAYS, if set, limits how far back it reaches. Returns:

  • dry run: {folder, action, destination, total_matches, would_handle, confirm_token (null when nothing matches), sample of up to 10 {from, subject, date}, note when more match than max_messages, safety_warnings}.

  • run: the same counts plus done, action_id and undo. Errors: no filter, move without destination, an unknown action or folder, or a bad or stale token (run the dry run again).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNoOnly messages containing this text.
sinceNoOnly messages on or after this date, YYYY-MM-DD.
actionYesmove, archive, trash (to the Trash, recoverable) or mark_read.
beforeNoOnly messages before this date, YYYY-MM-DD.
folderNoMail folder, e.g. INBOX, Sent, Archive or a custom name.INBOX
unreadNotrue = only unread, false = only read.
dry_runNotrue (default) = only preview: count, sample and a confirm_token. Nothing changes.
subjectNoOnly messages whose subject contains this.
destinationNoDestination folder, only for action 'move'.
from_addressNoOnly messages from this address or name (partial match).
max_messagesNoHandle at most this many, newest first (default 200, max 1000).
confirm_tokenNoFrom the dry run; required when dry_run=false.

Schema Changelog

Changes observed during successful MCP inspections.

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

TDQS

A5/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false, destructiveHint=false, and openWorldHint=true; the description adds substantial behavioral context beyond that. It discloses the two-step dry-run/confirm flow, token lifetime and invalidation conditions, Message-ID handling, undo support via mail_undo_bulk_action, permanent-deletion protections, and the MAIL_MAX_AGE_DAYS limit. This is exactly the kind of mutation and safety detail an agent needs.

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

Conciseness5/5

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

The description is long but proportionate to a 12-parameter, multi-step, safety-critical bulk operation. It is front-loaded with purpose and usage, then organizes parameters, behavior, returns, and errors into scannable sections; every sentence carries operational information not already available in the schema or annotations.

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?

There is no output schema, yet the description fully documents both dry-run and run return shapes, including counts, confirm_token behavior, sample contents, and notes. Error cases are enumerated, and the behavioral model around confirmation, token expiry, and undo is complete for an agent to invoke the tool correctly.

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%, so the baseline would be 3, but the description goes well beyond individual field documentation. It adds cross-parameter constraints (at least one filter is required, filters combine with AND), matching semantics (substring matching, text covers headers and body, since inclusive and before exclusive), conditional requirements (destination required for move and ignored otherwise), clamping behavior (max_messages 1..1000, newest matches), and the requirement to repeat preview parameters plus confirm_token on dry_run=false.

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?

The first sentence states a precise verb set, resource, scope, and workflow: 'Move, archive, trash or mark read every message in one folder that matches filters, in two steps (preview, then confirmed run) with a 30-day undo.' It explicitly distinguishes itself from mail_move_messages, mail_delete_messages, mail_mark_messages, and mail_unsubscribe_from_list, so an agent can select it without opening sibling schemas.

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?

Usage is explicitly bounded with a concrete example ('archive everything from news@example.org before March') and clear exclusions: not for a few known messages, not for flagging or marking unread, not for stopping future mail. Alternative tools are named for each excluded case, leaving no ambiguity about when to use this bulk operation.

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