Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

get_emails_by_date_range

Retrieve iCloud emails from a specific date range by providing start and end dates, with options to filter by mailbox and limit results.

Instructions

Get emails between two dates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStart date (YYYY-MM-DD)
endDateYesEnd date (YYYY-MM-DD)
mailboxNoMailbox (default INBOX)
limitNoMax results (default 10)

Implementation Reference

  • The implementation of get_emails_by_date_range which connects to IMAP, searches by date range, and fetches email details.
    export async function getEmailsByDateRange(startDate, endDate, mailbox = 'INBOX', limit = 10, creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const uids = (await client.search({ since: new Date(startDate), before: new Date(endDate) }, { 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 carries full burden for behavioral disclosure, yet it fails to indicate whether this is a read-only operation, what data structure is returned, or how pagination/limiting behaves despite the presence of a 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.

Conciseness4/5

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

Single sentence is efficiently worded without redundancy and places the core action at the front; however, it is arguably too brief given the tool's complexity and lack of supporting annotations.

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?

With 4 parameters, no output schema, no annotations, and numerous sibling retrieval tools, the 5-word description is insufficiently complete to support confident tool selection and invocation.

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?

Input schema has 100% description coverage for all 4 parameters (startDate, endDate, mailbox, limit), so the schema carries the semantic weight; the description adds no additional parameter context beyond implying date-range filtering.

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?

Description clearly states the action ('Get') and resource ('emails') with specific scope ('between two dates'), but fails to differentiate from siblings like search_emails or get_emails_by_sender that could overlap 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?

Provides no guidance on when to use this tool versus alternatives such as search_emails (which supports complex filtering) or get_emails_by_sender, nor any prerequisites or constraints beyond the date range.

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