Skip to main content
Glama

get_email

Retrieve detailed email information including headers, attachments, and body content from your mailbox using message ID or UID.

Instructions

Get detailed email information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderNoFolder containing the email (default: INBOX)INBOX
message_idNoMessage ID (sequence number)
uidNoUnique ID of the message
include_bodyNoInclude email body (default: true)

Implementation Reference

  • The core handler logic that fetches email data from an IMAP server.
    def get_email(
        self, folder: str, uid: int, headers_only: bool = False, decode_bodies: bool = True
    ) -> dict[str, Any]:
        """
        Fetch a single email.
    
        Args:
            folder: Folder containing the email
            uid: Email sequence number or UID
            headers_only: If True, fetch only headers (default: False)
            decode_bodies: If True, decode quoted-printable/base64 (default: True)
    
        Returns:
            Dictionary containing:
            - uid: Email UID
            - sequence_number: Sequence number
            - headers: Email headers as dict
            - subject: Subject line
            - from: From address
            - to: To addresses
            - date: Date header
            - message_id: Message-ID
            - body: Body text (if not headers_only)
            - html: HTML body (if available)
            - attachments: List of attachments (if any)
    
        Raises:
            EmailFetchError: If fetch fails
    
        Example:
  • Tool definition and schema for the 'get_email' tool, used by the MCP server to expose the functionality.
    Tool(
        name="get_email",
        description="Get detailed email information",
        inputSchema={
            "type": "object",
            "properties": {
                "folder": {
                    "type": "string",
                    "description": "Folder containing the email (default: INBOX)",
                    "default": "INBOX",
                },
                "message_id": {
                    "type": "string",
                    "description": "Message ID (sequence number)",
                },
                "uid": {
                    "type": "string",
                    "description": "Unique ID of the message",
                },
                "include_body": {
                    "type": "boolean",
                    "description": "Include email body (default: true)",
                    "default": True,
                },
            },
            "anyOf": [
                {"required": ["message_id"]},
                {"required": ["uid"]},
            ],
Behavior2/5

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

No annotations are provided, yet the description fails to disclose read-only safety, the 'anyOf' parameter logic (requiring either message_id OR uid), or what the 'detailed information' output contains. It leaves the agent guessing about prerequisites and return structure.

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 extremely brief (4 words) with no wasted text, but it is undersized for the tool's complexity (4 parameters with conditional requirements). However, it earns points for front-loading the core action without filler.

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 the parameter complexity (anyOf constraint between message_id/uid), lack of output schema, and absence of annotations, the description is inadequate. It fails to explain the mutual exclusivity logic or hint at the return format, leaving critical gaps in the agent's understanding.

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?

With 100% schema description coverage, the parameter meanings are already clear from the schema (folder, message_id, uid, include_body). The description adds no additional parameter context, meeting the baseline for high-coverage schemas.

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

Purpose3/5

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

The description states the basic verb ('Get') and resource ('email information'), but 'detailed' is vague—it doesn't specify what data is returned (headers, body, attachments) and doesn't differentiate from sibling 'search_emails' which also retrieves email data.

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

Usage Guidelines2/5

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

No guidance provided on when to use this single-email retrieval vs 'search_emails', nor does it mention that message_id or uid must be obtained from elsewhere (like list_folders or search_emails) before calling this tool.

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/AdJIa/mail-mcp-server'

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