Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

get_email_raw

Retrieve raw email data in RFC 2822 format with full headers and MIME body as base64-encoded content for debugging or export purposes.

Instructions

Get the raw RFC 2822 source of an email (full headers + MIME body) as base64-encoded data. Useful for debugging or export. Capped at 1 MB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesEmail UID
mailboxNoMailbox name (default INBOX)

Implementation Reference

  • Implementation of get_email_raw tool, which fetches the raw source of an email given its UID.
    export async function getEmailRaw(uid, mailbox = 'INBOX', creds = null) {
      const MAX_RAW_BYTES = 1 * 1024 * 1024; // 1 MB cap
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const msg = await client.fetchOne(uid, { source: true }, { uid: true });
      await client.logout();
      if (!msg || !msg.source) throw new Error(`Email UID ${uid} not found`);
      const source = msg.source;
      const truncated = source.length > MAX_RAW_BYTES;
      const slice = truncated ? source.slice(0, MAX_RAW_BYTES) : source;
      return {
        uid,
        size: source.length,
        truncated,
        data: slice.toString('base64'),
        dataEncoding: 'base64'
      };
    }
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral traits: base64 encoding format, inclusion of 'full headers + MIME body', and 'Capped at 1 MB' size limitation. Could improve by stating error behavior when limit exceeded.

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?

Three sentences with zero waste: core action (sentence 1), use case guidance (sentence 2), limitation warning (sentence 3). Front-loaded with the most critical information (RFC 2822 source).

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

Completeness4/5

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

For a simple 2-parameter fetch operation without output schema, description adequately covers return format, size constraints, and intended use cases. Missing only explicit read-only safety declaration, though implied by 'Get'.

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% ('Email UID', 'Mailbox name'), so baseline is 3. Description does not add parameter semantics beyond what schema provides, but none are needed given complete schema documentation.

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?

Specific verb 'Get' + precise resource 'raw RFC 2822 source' + format 'base64-encoded' clearly distinguishes from sibling 'get_email' by emphasizing raw headers/MIME body vs parsed content.

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

Usage Guidelines4/5

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

States 'Useful for debugging or export' providing clear contextual guidance on when to use this over standard email retrieval. Lacks explicit 'when not to use' or named alternative, but the niche use case is clearly signaled.

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/adamzaidi/icloud-mcp'

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