Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

get_unread_senders

Identify top senders of unread emails in iCloud Mail to prioritize inbox management and focus on important messages.

Instructions

Get top senders of unread emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mailboxNoMailbox to analyze (default INBOX)
sampleSizeNoNumber of emails to sample (default 500)
maxResultsNoMax number of senders to return (default 20)

Implementation Reference

  • Implementation of the `get_unread_senders` tool handler, which connects to the mailbox, searches for unread emails, and calculates the top senders from those unread emails.
    export async function getUnreadSenders(mailbox = 'INBOX', sampleSize = 500, maxResults = 20, creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const uids = (await client.search({ seen: false }, { uid: true })) ?? [];
      const recentUids = uids.reverse().slice(0, sampleSize);
      const senderCounts = {};
    
      if (recentUids.length === 0) {
        await client.logout();
        return [];
      }
    
      for await (const msg of client.fetch(recentUids, { envelope: true }, { uid: true })) {
        const address = msg.envelope.from?.[0]?.address;
        if (address) senderCounts[address] = (senderCounts[address] || 0) + 1;
      }
    
      await client.logout();
      return Object.entries(senderCounts).sort((a, b) => b[1] - a[1]).slice(0, maxResults).map(([address, count]) => ({ address, count }));
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but fails to state whether this is read-only (implied by 'Get' but not explicit), what data structure is returned, or how 'top' is calculated. No mention of pagination or rate limits.

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 (6 words) and front-loaded with no filler. While not wasteful, the brevity contributes to under-specification given the lack of annotations and output schema.

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 absence of an output schema and annotations, the description should explain the return format (list of sender strings? objects with counts?) and ranking logic. It provides neither, leaving significant gaps for an agent attempting to interpret results or handle errors.

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 coverage is 100%, so the schema adequately documents all three parameters (mailbox, sampleSize, maxResults). The description mentions 'top senders' which loosely maps to maxResults, but doesn't add syntax details or usage guidance beyond the schema definitions. Baseline score appropriate given schema completeness.

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 states a clear verb ('Get') and resource ('senders of unread emails'), and the 'unread' qualifier distinguishes it from sibling tool 'get_top_senders'. However, it doesn't define what 'top' means (frequency, recency, etc.), leaving the ranking criteria ambiguous.

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 'get_top_senders', 'get_inbox_summary', or 'search_emails'. No mention of prerequisites, performance implications of the sampleSize parameter, or when bulk operations might be preferred.

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