Skip to main content
Glama
apple-mail-mcp

apple-mail-mcp

by sweetrb

batch-flag-messages

Idempotent

Flag 1–100 Apple Mail messages in one call, optionally applying a color, and return counts of successes and failures.

Instructions

Use when: flagging multiple messages (1–100 ids) in one call, optionally with a color (red/orange/yellow/green/blue/purple/gray). Returns: counts of how many were flagged and how many failed. Do not use when: flagging just one (use flag-message) or removing flags (use batch-unflag-messages). Get the ids from search-messages or list-messages first. Pass sourceMailbox/sourceAccount (the mailbox you listed the ids from) so each numeric id is pinned to that mailbox; an id that matches in several mailboxes is refused, not guessed. Note: the color is applied on both routes — AppleScript sets the flag index, IMAP writes the equivalent $MailFlagBit0/1/2 keywords Mail.app reads — so a mixed batch of numeric and imap: ids all end up colored, and search-messages' flagColor filter finds the whole set again later regardless of mailbox.

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": {
      "ids": "<ids>"
    },
    "name": "batch-flag-messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
idsYes
colorNoOptional flag color (Apple Mail palette: red, orange, yellow, green, blue, purple, gray — 'grey' accepted). Omit for Mail's default flag. The color is applied on both routes: AppleScript sets the flag index, and IMAP writes the equivalent $MailFlagBit0/1/2 keywords Mail.app reads — so a smart mailbox keyed on flag color matches either way.
sourceAccountNoAccount the numeric ids were listed from. Required when sourceMailbox is supplied; on its own it pins nothing.
sourceMailboxNoMailbox the numeric ids were listed from (e.g. 'INBOX'). Must be paired with sourceAccount to form an unambiguous scope. Ignored for imap: ids.

Output Schema

NameRequiredDescriptionDefault
okNo
errorsNo
failedNo
mailboxNo
successNo
errorsTruncatedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv2.10.24
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / sourceAccount
      Added value: +{
      +  "description": "Account the numeric ids were listed from. Required when sourceMailbox is supplied; on its own it pins nothing.",
      +  "type": "string"
      +}
    • addedInput schema / properties / sourceMailbox
      Added value: +{
      +  "description": "Mailbox the numeric ids were listed from (e.g. 'INBOX'). Must be paired with sourceAccount to form an unambiguous scope. Ignored for imap: ids.",
      +  "type": "string"
      +}
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / errors
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / errorsTruncated
      Added value: +{
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changedv2.10.8
    • changedInput schema / properties / color / description
      Previous value: -"Optional flag color (Apple Mail palette: red, orange, yellow, green, blue, purple, gray — 'grey' accepted). Omit for Mail's default flag. Colors are applied via Mail.app (AppleScript); for an IMAP-routed message id the flag is set but the color is not applied (IMAP flags are colorless)."New value: +"Optional flag color (Apple Mail palette: red, orange, yellow, green, blue, purple, gray — 'grey' accepted). Omit for Mail's default flag. The color is applied on both routes: AppleScript sets the flag index, and IMAP writes the equivalent $MailFlagBit0/1/2 keywords Mail.app reads — so a smart mailbox keyed on flag color matches either way."
    • changedOutput schema / additionalProperties
      Previous value: -falseNew value: +true
  3. Addedv2.8.14
  4. Removedv2.8.10
  5. Changed1 schema field changedv2.8.2
    • addedInput schema / properties / color
      Added value: +{
      +  "description": "Optional flag color (Apple Mail palette: red, orange, yellow, green, blue, purple, gray — 'grey' accepted). Omit for Mail's default flag. Colors are applied via Mail.app (AppleScript); for an IMAP-routed message id the flag is set but the color is not applied (IMAP flags are colorless).",
      +  "enum": [
      +    "red",
      +    "orange",
      +    "yellow",
      +    "green",
      +    "blue",
      +    "purple",
      +    "gray",
      +    "grey"
      +  ],
      +  "type": "string"
      +}
  6. First observedv2.6.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover safety (readOnly=false, idempotent=true, destructive=false), yet the description adds real behavior: partial-failure counts, refusal of ids that match multiple mailboxes rather than guessing, and a route-level explanation of why color works for both numeric and imap: ids. These are non-obvious operational facts the annotations cannot convey.

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?

Labeled sections ('Use when', 'Returns', 'Do not use when', 'Note') keep it front-loaded and scannable. The closing Note on AppleScript flag index vs. IMAP $MailFlagBit keywords is dense and the longest part, though it does justify a claim (flagColor searchability) rather than padding.

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 values need not be detailed, and the description still summarizes flagged/failed counts. Combined with prerequisites, mailbox pinning, ambiguity handling, and mixed-id behavior, an agent has everything needed to call this correctly on the first try.

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

Parameters4/5

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

Schema coverage is 75% and the schema already documents color and sourceMailbox mechanics, but the description adds the crucial pinning semantic — pass sourceMailbox/sourceAccount so a numeric id is bound to one mailbox, with ambiguous ids refused — plus the note that source params are irrelevant for imap: ids. That goes beyond the property text, though it largely restates the color-route note found in the schema.

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 specific verb and resource with scope: 'flagging multiple messages (1–100 ids) in one call, optionally with a color'. The sibling set includes single-item and batch variants, and the description makes the batch-vs-single distinction explicit rather than leaving it to inference.

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 'Use when' and 'Do not use when' block, names both alternatives (flag-message for one, batch-unflag-messages for removal), and adds a prerequisite: get ids from search-messages or list-messages first. That is the full when/when-not/alternatives trifecta plus setup ordering.

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