Skip to main content
Glama
apple-mail-mcp

apple-mail-mcp

by sweetrb

get-message-headers

Read-only

Retrieves raw RFC 5322 headers (Date, Message-ID, Received, custom X-headers) for a message ID to analyze routing or debug metadata without downloading the email body.

Instructions

Use when: you need a message's raw RFC 5322 headers — the author's Date: header (not the mailbox arrival time), Message-ID, In-Reply-To/References, the Received: hop trace, or any custom X- header — for a message whose id you already have (numeric or imap:…). Cheap: never downloads the body or attachments. Returns: the raw header block (text), every header as ordered {name, value} pairs with folding undone, and the decoded key fields: date (ISO 8601, from the Date: header), dateHeader (verbatim), dateReceived (mailbox arrival time — the value a migration or re-import resets, so compare it with date), messageId, subject, from, to, cc, replyTo, inReplyTo, references[], received[], backend (imap or applescript), and warnings[] when a malformed block was repaired. Tip: pass the mailbox+account you got the id from so a numeric id is fetched directly instead of scanning every mailbox. Do not use when: you want the body (use get-message), the conversation (use get-thread), or only the Message-ID (get-message already returns rfcMessageId).

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-headers"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYes
accountNoAccount that holds the message. Pair with `mailbox` for a direct fetch.
mailboxNoMailbox that holds the message (numeric ids are unique per mailbox). With `account`, opens that mailbox directly instead of scanning every mailbox.

Output Schema

NameRequiredDescriptionDefault
ccNo
idNo
toNo
rawNoThe raw header block, exactly as stored
dateNoISO 8601 from the Date: header — the author's send time
fromNo
backendNoWhich backend read the headers: "imap" (the stored bytes over IMAP) or "applescript" (Mail's `all headers` property, which Mail renders itself and can alter)
headersNo
replyToNo
subjectNoRFC 2047-decoded Subject:
receivedNoEvery Received: header, as written (first = last hop)
warningsNoRepairs applied to a malformed header block, in plain words — e.g. a Date: value Mail.app dropped with the next header joined onto it. Absent when none fired; `raw` is never rewritten.
inReplyToNo
messageIdNoBare RFC 5322 Message-ID
dateHeaderNoThe Date: header verbatim
referencesNo
headerCountNo
dateReceivedNoISO 8601 mailbox arrival time (INTERNALDATE / Mail's `date received`)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.19.7
    • addedOutput schema / properties / backend
      Added value: +{
      +  "description": "Which backend read the headers: \"imap\" (the stored bytes over IMAP) or \"applescript\" (Mail's `all headers` property, which Mail renders itself and can alter)",
      +  "type": "string"
      +}
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "description": "Repairs applied to a malformed header block, in plain words — e.g. a Date: value Mail.app dropped with the next header joined onto it. Absent when none fired; `raw` is never rewritten.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Addedv2.19.2

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnlyHint/openWorldHint annotations it discloses real behavioral traits: it never downloads the body or attachments (cost profile), it reports which backend served the request (imap or applescript), it emits warnings[] when a malformed header block was repaired, and it distinguishes date from dateReceived with the migration caveat.

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?

Structurally strong and front-loaded with the 'Use when' clause, then Returns, Tip, and 'Do not use when'. The Returns block is long and partly redundant with the existing output schema, which is the only thing keeping this from a 5.

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 read-only, three-parameter fetch tool with annotations and an output schema, nothing an agent needs is missing: precondition, cheapness guarantee, id formats, the direct-fetch optimization, and the sibling alternatives are all covered.

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 67%, so account and mailbox are partially documented already, but the description adds the operative consequence the schema does not spell out: supplying mailbox+account fetches a numeric id directly instead of scanning every mailbox, and it restates the accepted id forms (numeric or imap:…).

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 names a specific verb and resource ('raw RFC 5322 headers') and enumerates exactly which headers are returned (Date, Message-ID, In-Reply-To/References, Received, X- headers), which distinguishes it from get-message and get-message-rfc822 without opening their 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?

It has an explicit 'Use when' clause grounded in a precondition ('a message whose id you already have') and an explicit 'Do not use when' clause naming the alternatives: get-message for the body, get-thread for the conversation, and get-message for rfcMessageId alone.

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