Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

bulk_delete_by_subject

Delete multiple emails at once by matching a subject pattern in iCloud Mail. Use this tool to remove unwanted messages and maintain inbox organization through bulk operations.

Instructions

Delete all emails matching a subject pattern

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subjectYesSubject keyword to match
mailboxNoMailbox (default INBOX)

Implementation Reference

  • The 'bulk_delete_by_subject' function implements the deletion logic by searching for emails with a specific subject and deleting them in chunks.
    export async function bulkDeleteBySubject(subject, mailbox = 'INBOX', creds = null) {
      const client = createRateLimitedClient(creds);
      await client.connect();
      await client.mailboxOpen(mailbox);
      const uids = (await client.search({ subject }, { 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, subject };
    }

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