Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

bulk_move

Move filtered emails between iCloud mailboxes using copy-verify-delete with fingerprint verification. Preview changes with dry run mode before executing.

Instructions

Move emails matching any combination of filters from one mailbox to another. Uses safe copy-verify-delete with fingerprint verification and a persistent manifest. Use dryRun: true to preview without making changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetMailboxYesDestination mailbox path
sourceMailboxNoSource mailbox (default INBOX)
dryRunNoIf true, preview what would be moved without actually moving
limitNoMaximum number of emails to move (default: all matching)
senderNoMatch exact sender email address
domainNoMatch any sender from this domain (e.g. substack.com)
subjectNoKeyword to match in subject
beforeNoOnly emails before this date (YYYY-MM-DD)
sinceNoOnly emails since this date (YYYY-MM-DD)
unreadNoTrue for unread only, false for read only
flaggedNoTrue for flagged only, false for unflagged only
largerNoOnly emails larger than this size in KB
smallerNoOnly emails smaller than this size in KB
hasAttachmentNoOnly emails with attachments (client-side BODYSTRUCTURE scan — must be combined with other filters that narrow results to under 500 emails first)
accountNoAccount name to use (e.g. 'icloud', 'gmail'). Defaults to first configured account. Use list_accounts to see available accounts.

Implementation Reference

  • The bulk_move function searches for emails matching the filters, ensures the target mailbox exists, and then performs a safe move operation using safeMoveEmails.
    export async function bulkMove(filters, targetMailbox, sourceMailbox = 'INBOX', dryRun = false, limit = null, creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(sourceMailbox);
      const query = buildQuery(filters);
      let uids = (await client.search(query, { uid: true })) ?? [];
      if (filters.hasAttachment) {
        if (uids.length > ATTACHMENT_SCAN_LIMIT) {
          await client.logout();
          return { error: `hasAttachment requires narrower filters first — ${uids.length} candidates exceeds scan limit of ${ATTACHMENT_SCAN_LIMIT}.` };
        }
        uids = await filterUidsByAttachment(client, uids);
      }
      await client.logout();
    
      if (limit !== null) uids = uids.slice(0, limit);
    
      if (dryRun) {
        return { dryRun: true, wouldMove: uids.length, sourceMailbox, targetMailbox, filters };
      }
      if (uids.length === 0) return { moved: 0, sourceMailbox, targetMailbox };
    
      await ensureMailbox(targetMailbox, creds);
      const result = await safeMoveEmails(uids, sourceMailbox, targetMailbox, creds);
      return { ...result, sourceMailbox, targetMailbox, filters };
    }
Behavior4/5

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

With no annotations provided, the description carries full disclosure burden. It excellently documents the safety mechanism ('safe copy-verify-delete with fingerprint verification and a persistent manifest') and idempotency characteristics, critical for a destructive move operation. However, it omits potential rate limits, error handling behavior, or confirmation that source emails are deleted after verification.

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 efficiently structured: purpose statement, safety mechanism disclosure, and usage guidance. Every sentence earns its place with zero redundancy or filler. Technical details (fingerprint verification, persistent manifest) are packed concisely without sacrificing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 15-parameter destructive operation with no output schema, the description adequately covers the mechanism and safety but leaves gaps regarding return value structure (only hinting at a 'manifest'), success/failure indicators, and specific warnings about the hasAttachment constraint documented in the schema. Functional but not comprehensive.

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, establishing a baseline of 3. The description adds the concept of 'any combination of filters' which reinforces how the multiple filter parameters interact, and explicitly highlights the dryRun parameter's utility, but does not elaborate on specific parameter formats (e.g., date formats) or constraints beyond what the schema already provides.

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?

The description explicitly states 'Move emails matching any combination of filters from one mailbox to another', providing a specific verb, resource, and scope. The phrase 'any combination of filters' effectively distinguishes this tool from siblings like bulk_move_by_sender or bulk_move_by_domain which likely support limited filter types, and from move_email which likely handles single emails.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides valuable safety guidance with 'Use dryRun: true to preview without making changes', but lacks explicit guidance on when to use this general-purpose filterable version versus the specialized bulk_move_by_sender/bulk_move_by_domain variants. No prerequisites or exclusion criteria are mentioned.

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