Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

get_email_headers

Extract email headers quickly to preview sender, subject, and date information without downloading full message content.

Instructions

Get only email headers (faster)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesEmail UID
mailboxNoMailbox name (default: current)

Implementation Reference

  • The core implementation of get_email_headers which fetches and parses email headers using the IMAP client.
    def get_email_headers(self, uid: int, mailbox: Optional[str] = None) -> EmailHeader:
        """Get only email headers (faster)."""
        self._ensure_connected()
        if mailbox:
            self.select_mailbox(mailbox)
    
        data = self.client.fetch([uid], ["ENVELOPE", "FLAGS", "RFC822.SIZE"])
        if uid not in data:
            raise ValueError(f"Email with UID {uid} not found")
    
        return self._parse_email_header(uid, data[uid])
  • Tool definition and registration for 'get_email_headers' within the MCP server.
    make_tool(
        "get_email_headers",
        "Get only email headers (faster)",
        {
            "uid": {"type": "number", "description": "Email UID"},
            "mailbox": {"type": "string", "description": "Mailbox name (default: current)"},
        },
        ["uid"],
    ),
  • The MCP server call handler that routes the 'get_email_headers' tool request to the IMAP client method.
    elif name == "get_email_headers":
        return imap_client.get_email_headers(
            uid=args["uid"],
            mailbox=args.get("mailbox"),
        )
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'faster' as a behavioral trait, which is useful, but lacks critical details: it doesn't specify if this is a read-only operation, what permissions are required, how errors are handled, or the format/structure of returned headers. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise—a single phrase with no wasted words. It's front-loaded with the core purpose ('Get only email headers') and includes a useful qualifier ('faster'). Every part of the description earns its place by adding value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a tool that likely returns structured data (email headers), the description is incomplete. It doesn't explain what headers are returned, the response format, or any behavioral constraints. For a tool with two parameters and no structured output documentation, this leaves too much unspecified for reliable use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents both parameters (uid and mailbox). The description adds no additional parameter information beyond what's in the schema, such as explaining what 'uid' represents in context or default behavior for 'mailbox'. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('email headers'), making the purpose understandable. It distinguishes itself from siblings like 'get_email' or 'get_email_body' by specifying 'only email headers', but doesn't explicitly name these alternatives or explain the functional difference beyond speed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context with '(faster)', suggesting this tool should be chosen over full email retrieval when speed is prioritized and only headers are needed. However, it doesn't explicitly state when to use this versus alternatives like 'get_email' or 'get_email_body', nor does it mention prerequisites or exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Soundhannes/IMAP-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server