Skip to main content
Glama
apple-mail-mcp

apple-mail-mcp

by sweetrb

get-message-rfc822

Retrieve a message's exact original RFC 822 bytes from IMAP for archival, forensic review, or verifiable .eml files, including UID identity and SHA-256 hash.

Instructions

Use when: you need a message's complete original RFC 822 bytes exactly as the IMAP server stores them — for archival, forensic review, evidence preservation, or a verifiable .eml — together with the IMAP identity that links back to the source (uid, uidValidity, internalDate, flags, RFC822.SIZE) and a SHA-256 of the acquired bytes. IMAP-only: needs an imap: id from list-messages/search-messages on an IMAP-configured account. Returns: the acquisition record (account, mailbox, uid, uidValidity, internalDate, flags, size, bytes, sha256, messageId, readMethod, backend, warnings) plus either contentBase64 — the bytes, base64-encoded, carried in structuredContent only — or savedPath when savePath was given. No decoding, charset conversion, line-ending change or MIME re-serialization is applied. Do not use when: you want readable content (use get-message), only the headers (use get-message-headers), or one attachment (use fetch-attachment / save-attachment); or when the id is numeric — Mail.app's AppleScript bridge exposes its own rendering, not the stored bytes, so there is no AppleScript path. Safety: strictly read-only against the mailbox — EXAMINE + BODY.PEEK[], so \Seen is not set and no STORE/COPY/MOVE/APPEND/EXPUNGE is issued; no Mail.app, AppleScript or osascript involved. Inline results are capped at 6 MiB of raw bytes (maxBytes) to stay under the MCP stdio 10 MB message limit; larger messages need savePath, which creates exactly one new file (never overwrites, mode 0600) inside the configured allowed roots, up to 25 MiB.

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": {
      "id": "<id>"
    },
    "name": "get-message-rfc822"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesAn imap: message id (numeric Mail.app ids are refused)
fileNameNoFile name to use with savePath (no path separators or '..'). Default: <account>-<mailbox>-uidv<uidValidity>-uid<uid>.eml
maxBytesNoRefuse (never truncate) a message larger than this many raw bytes. Default and inline maximum 6291456 (6 MiB); with savePath up to 26214400 (25 MiB)
savePathNoDirectory inside the allowed roots to write the .eml into instead of returning base64; raises the ceiling to 25 MiB

Output Schema

NameRequiredDescriptionDefault
idNo
uidNo
sizeNoRFC822.SIZE as reported by the server
bytesNoNumber of bytes acquired (and hashed)
flagsNo
sha256NoHex SHA-256 over exactly the acquired bytes
accountNo
backendNo
mailboxNo
warningsNo
messageIdNoBare RFC 5322 Message-ID from ENVELOPE, for convenience; the authoritative copy is in the bytes
savedPathNo
readMethodNoThe IMAP commands used
uidValidityNoMailbox UIDVALIDITY as a decimal string; with uid, the durable identity of the source message
internalDateNoISO 8601 IMAP INTERNALDATE (arrival), not the Date: header
contentBase64NoThe acquired bytes, base64-encoded (absent when savePath was used)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.19.12

TDQS

A4.4/5.0
Behavior3/5

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

The description discloses a great deal beyond the annotations: EXAMINE + BODY.PEEK[] so \Seen is not set, no STORE/COPY/MOVE/APPEND/EXPUNGE, no Mail.app or osascript involvement, a 6 MiB inline cap tied to the 10 MB stdio limit, and savePath creating exactly one new file at mode 0600 inside allowed roots without overwriting. However, the annotations declare readOnlyHint=false while the description's headline safety claim is 'strictly read-only against the mailbox'; the description never reconciles the two, leaving the agent to infer that the non-read-only aspect is the optional file write. Note the description also asserts a self-imposed ceiling consistency (6 MiB inline / 25 MiB with savePath) that matches maxBytes in the schema, so no numeric contradiction.

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 trigger condition, then returns, then exclusions, then safety — a logical order for an agent reading top-down. It is dense and long, but nearly every clause carries load-bearing constraint information (byte-exactness, no re-serialization, file mode, caps); only the enumerated acquisition-record field list is somewhat redundant given the output schema exists.

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 byte-acquisition tool with a mutation-adjacent file-write side effect, the description covers the guarantees an agent must know: byte-exact no-transformation behavior, where the bytes land (structuredContent vs savedPath), size ceilings and the failure mode (refuse, not truncate), and mailbox non-mutation. The output schema carries the return shape, so the prose needn't.

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 100%, so the 3 baseline is already met; the description still adds rationale the schema lacks — that maxBytes refuses rather than truncates, why the 6 MiB inline cap exists (MCP stdio 10 MB message limit), that savePath is what raises the ceiling to 25 MiB, and that contentBase64 lives in structuredContent only. It does not restate the fileName default or id pattern, which the schema already covers.

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?

Names a specific verb+resource ('complete original RFC 822 bytes exactly as the IMAP server stores them') and immediately scopes it against the three nearest siblings (get-message, get-message-headers, fetch-attachment/save-attachment). An agent can distinguish it from every listed sibling without opening a schema.

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?

Uses explicit 'Use when' / 'Do not use when' structure with named alternatives and the condition that selects each one. It also states a hard precondition (must be an imap: id from list-messages/search-messages on an IMAP-configured account) and rules out the numeric-id path entirely.

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