Skip to main content
Glama
sweetrb

apple-mail-mcp

by sweetrb

get-message-headers

Read-only

Get raw email headers (Date, Message-ID, References, Received trace, X-headers) by message ID to inspect routing, threading, or authenticity without fetching the 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).

Input Schema

TableJSON 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

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

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

Annotations only declare readOnlyHint, but the description adds critical behavioral context: it never downloads body/attachments ('Cheap'), it returns raw header text, ordered name/value pairs with folding undone, and decoded fields including dateReceived vs date (with explanation of mailbox arrival time vs Date header). It also discloses warnings[] for repaired malformed blocks. This is rich behavioral disclosure beyond the annotation.

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?

The description is longer than average but well-structured with clear sections (Use when, Returns, Tip, Do not use). Every sentence adds value; nothing is redundant. The purpose is front-loaded, and the 'Do not use' section is at the end. Minor deduction for length, but it's efficient given the tool's complexity.

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?

Despite having an output schema (not shown), the description thoroughly covers what the tool returns, including decoded fields and warnings behavior. It also covers performance expectations, input requirements, and exclusions. An agent would have everything needed to invoke this tool correctly without additional research.

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

Parameters5/5

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

Schema covers 67% of parameters (account and mailbox have descriptions, id only has a pattern). The description explains the id formats (numeric or imap:...) and provides the tip that pairing mailbox+account enables direct fetch instead of scanning all mailboxes. This adds meaning beyond the schema's pattern, clarifying the relationship between parameters and their optimization effect.

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 opens with a precise purpose: retrieving raw RFC 5322 headers, listing specific header types (Date, Message-ID, In-Reply-To, Received, X-). It clearly differentiates from siblings get-message (body) and get-thread (conversation), and even notes get-message returns rfcMessageId for the Message-ID case. This leaves no ambiguity about what the tool does.

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 explicitly states 'Use when' and 'Do not use when' with concrete alternatives (get-message, get-thread, get-message for rfcMessageId). It also gives a practical tip about passing mailbox+account for direct fetch. This is exemplary routing guidance that saves the agent from guessing.

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