get-message-headers
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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| account | No | Account that holds the message. Pair with `mailbox` for a direct fetch. | |
| mailbox | No | Mailbox that holds the message (numeric ids are unique per mailbox). With `account`, opens that mailbox directly instead of scanning every mailbox. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cc | No | ||
| id | No | ||
| to | No | ||
| raw | No | The raw header block, exactly as stored | |
| date | No | ISO 8601 from the Date: header — the author's send time | |
| from | No | ||
| backend | No | 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) | |
| headers | No | ||
| replyTo | No | ||
| subject | No | RFC 2047-decoded Subject: | |
| received | No | Every Received: header, as written (first = last hop) | |
| warnings | No | 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. | |
| inReplyTo | No | ||
| messageId | No | Bare RFC 5322 Message-ID | |
| dateHeader | No | The Date: header verbatim | |
| references | No | ||
| headerCount | No | ||
| dateReceived | No | ISO 8601 mailbox arrival time (INTERNALDATE / Mail's `date received`) |