Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

delete_older_than

Remove emails older than a specified number of days from iCloud Mail to manage storage and organize your inbox by automatically clearing outdated messages.

Instructions

Delete all emails older than a certain number of days

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYesDelete emails older than this many days
mailboxNoMailbox (default INBOX)

Implementation Reference

  • Handler function for deleting emails older than a specified number of days in a given mailbox.
    export async function deleteOlderThan(days, mailbox = 'INBOX', creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const date = new Date();
      date.setDate(date.getDate() - days);
      const uids = (await client.search({ before: date }, { uid: true })) ?? [];
      if (uids.length === 0) { await client.logout(); return { deleted: 0 }; }
      let deleted = 0;
      for (let i = 0; i < uids.length; i += CHUNK_SIZE) {
        const chunk = uids.slice(i, i + CHUNK_SIZE);
        await client.messageDelete(chunk, { uid: true });
        deleted += chunk.length;
      }
      await client.logout();
      return { deleted, olderThan: date.toISOString() };
    }
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 provides minimal safety context. It does not specify whether deleted emails move to trash (recoverable) or are permanently deleted, nor does it mention performance implications of bulk operations or verification requirements.

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 a single, efficient sentence of nine words with no redundancy. However, extreme brevity comes at the cost of omitting critical safety and behavioral context that a destructive bulk operation demands.

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?

For a destructive bulk operation with no annotations and no output schema, the description is inadequate. It fails to explain return values (success confirmation, count deleted), reversibility (trash vs permanent), or preconditions (permissions, mailbox existence validation).

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%, with both 'days' and 'mailbox' parameters fully documented in the schema. The description references the date threshold ('older than a certain number of days') which aligns with the schema, meeting the baseline expectation when structured documentation is complete.

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 clearly states the action (Delete), resource (emails), and scope (older than X days). However, it fails to distinguish from the sibling tool 'archive_older_than', which has similar parameters but fundamentally different outcomes (preservation vs removal).

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 is provided on when to use this tool versus 'archive_older_than' (for non-destructive cleanup) or versus 'bulk_delete' (which may use different selection criteria). Given the irreversible nature of deletion, this lack of comparative guidance is a significant gap.

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