Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

archive_older_than

Move emails older than a specified number of days from a source mailbox to an archive folder using a safe copy-verify-delete process. Preview changes with dry run mode.

Instructions

Safely move emails older than N days from a source mailbox to an archive folder. Uses the same safe copy-verify-delete pipeline as bulk_move. Use dryRun: true to preview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYesArchive emails older than this many days
targetMailboxYesDestination archive folder (e.g. Archive)
sourceMailboxNoSource mailbox (default INBOX)
dryRunNoIf true, preview what would be moved without moving

Implementation Reference

  • The handler function that implements the "archive_older_than" tool. It searches for emails older than a given number of days and moves them to a target mailbox.
    export async function archiveOlderThan(days, targetMailbox, sourceMailbox = 'INBOX', dryRun = false, creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(sourceMailbox);
      const date = new Date();
      date.setDate(date.getDate() - days);
      const raw = await client.search({ before: date }, { uid: true });
      const uids = Array.isArray(raw) ? raw : [];
      await client.logout();
      if (dryRun) return { dryRun: true, wouldMove: uids.length, olderThan: date.toISOString(), sourceMailbox, targetMailbox };
      if (uids.length === 0) return { moved: 0, olderThan: date.toISOString(), sourceMailbox, targetMailbox };
      await ensureMailbox(targetMailbox, creds);
      const result = await safeMoveEmails(uids, sourceMailbox, targetMailbox, creds);
      return { ...result, olderThan: date.toISOString(), sourceMailbox, targetMailbox };
    }
Behavior3/5

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

No annotations provided, so description carries full burden. Explains the 'copy-verify-delete pipeline' safety mechanism and dryRun preview capability. Missing: error handling behavior, confirmation of whether source emails are deleted after copy, rate limits, or idempotency guarantees expected for mutation tools.

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: purpose statement, safety pipeline disclosure, and usage tip. Front-loaded with specific operation details; every clause earns its place.

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?

Appropriate for a 4-parameter mutation tool with no output schema. Covers the safety semantics (crucial for a 'move' operation) and preview capability. Could improve by clarifying the destructive aspect of the source deletion or referencing the default INBOX behavior mentioned in schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Description adds value by framing dryRun as a 'preview' usage pattern and contextualizing 'N days' within the archiving workflow. Connects the 'targetMailbox' parameter to the archive folder concept explicitly.

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 ('move') with clear resource ('emails'), condition ('older than N days'), and endpoints ('source mailbox' to 'archive folder'). The 'archive' semantic distinguishes it from sibling delete_older_than and general bulk_move operations.

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?

Provides explicit guidance to 'Use dryRun: true to preview' and references implementation similarity to bulk_move. However, lacks explicit when-to-use vs destructive alternatives like delete_older_than or simple move_email given the large sibling tool set.

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