Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

get_emails_by_sender

Retrieve emails from a specific sender in your iCloud Mail account. Filter messages by sender address or domain, specify mailbox, and set result limits.

Instructions

Get all emails from a specific sender

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
senderYesSender email address or domain
mailboxNoMailbox to search (default INBOX)
limitNoMax results to show (default 10)

Implementation Reference

  • Implementation of get_emails_by_sender tool, which connects to IMAP, searches for emails from a sender, fetches details for recent ones, and returns them.
    export async function getEmailsBySender(sender, mailbox = 'INBOX', limit = 10, creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const uids = (await client.search({ from: sender }, { uid: true })) ?? [];
      const total = uids.length;
      const recentUids = uids.slice(-limit).reverse();
      const emails = [];
      for (const uid of recentUids) {
        const msg = await client.fetchOne(uid, { envelope: true, flags: true }, { uid: true });
        if (msg) {
          emails.push({
            uid,
            subject: msg.envelope.subject,
            from: msg.envelope.from?.[0]?.address,
            date: msg.envelope.date,
            flagged: msg.flags.has('\\Flagged'),
            seen: msg.flags.has('\\Seen')
          });
        }
      }
      await client.logout();
      return { total, showing: emails.length, emails };
    }
Behavior2/5

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

No annotations are provided, so the description must carry full behavioral disclosure burden. It fails to clarify whether results include full message bodies or just metadata (given 'get_email' exists for individual retrieval), pagination behavior, or the conflict between 'all' and the limit parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single-sentence structure is appropriately brief, but the use of 'all' is misleading given the limit parameter, wasting the limited descriptive real estate on inaccurate scope definition.

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 50+ sibling tools including multiple search/retrieval variants and no output schema, the description is insufficient. It should clarify return format (list of IDs vs full objects), distinguish from 'search_emails', and explain the domain-search capability implied by the parameter schema.

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 (all 3 parameters documented), the baseline is 3. The description adds no additional parameter context (e.g., that 'sender' accepts domains per the schema description, or that 'limit' defaults to 10).

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 core action (Get) and filter (specific sender), but claims 'all' emails which contradicts the default limit of 10 in the schema. It also fails to distinguish from the sibling 'search_emails' tool, which likely overlaps in functionality.

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 versus 'search_emails' or 'get_emails_by_date_range'. Does not mention prerequisites like mailbox access permissions or whether sender accepts domains (as hinted in parameter schema).

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