Skip to main content
Glama
sweetrb

apple-mail-mcp

by sweetrb

get-message-rfc822

Retrieve a message's exact RFC 822 bytes as stored on IMAP, with UID, flags, size, and SHA-256 for archival or forensic evidence. Read-only, no decoding or changes to the email.

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.

Input Schema

TableJSON 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

TableJSON 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.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and succeeds: it states the tool is strictly read-only via EXAMINE + BODY.PEEK[], that \Seen is not set, and that no STORE/COPY/MOVE/APPEND/EXPUNGE is issued. It also discloses byte-fidelity guarantees, size caps, file creation semantics (never overwrites, mode 0600), and that no AppleScript/osaScript is involved.

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 deliberately sectioned with 'Use when', 'Returns', 'Do not use when', and 'Safety', and the most decision-relevant guidance is front-loaded. It is long, but every sentence conveys a distinct operational constraint or selection criterion; no filler or repetition of schema-only information is present.

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?

Given the tool's complexity, the absence of annotations, and the presence of an output schema, the description is remarkably complete. It covers selection criteria, prerequisites, return shape, byte-fidelity guarantees, safety behavior, size limits, file-writing behavior, and refusals. An agent has everything needed to decide whether and how to invoke the tool correctly.

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 description coverage is 100%, so the schema already documents all parameters. The description adds meaningful context beyond the schema: it explains the relationship between maxBytes and inline vs. savePath limits, that contentBase64 appears only in structuredContent, and that savePath returns savedPath instead of base64. This is more than baseline value, though not a full per-parameter specification.

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 description states a specific verb and resource: retrieving a message's 'complete original RFC 822 bytes exactly as the IMAP server stores them' along with IMAP identity metadata and SHA-256. It clearly distinguishes this tool from siblings such as get-message, get-message-headers, and fetch-attachment by naming what this tool is and is not for.

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?

The description provides explicit 'Use when' and 'Do not use when' guidance, naming concrete alternatives like get-message, get-message-headers, and fetch-attachment. It also states the prerequisite that an imap: id from list-messages/search-messages is required, and explains why numeric Mail.app ids are refused. This leaves no ambiguity about when to choose this tool.

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