Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

mark_older_than_read

Mark unread emails older than a specified number of days as read to clean up your inbox through bulk triage.

Instructions

Mark all unread emails older than N days as read. Useful for bulk triage of a cluttered inbox.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYesMark emails older than this many days as read
mailboxNoMailbox (default INBOX)

Implementation Reference

  • The function `markOlderThanRead` marks emails older than a specified number of days as read. It connects to the IMAP server, searches for unread messages before the calculated date, and adds the `\Seen` flag to them.
    export async function markOlderThanRead(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 raw = await client.search({ before: date, seen: false }, { uid: true });
      const uids = Array.isArray(raw) ? raw : [];
      if (uids.length === 0) { await client.logout(); return { marked: 0, olderThan: date.toISOString() }; }
      await client.messageFlagsAdd(uids, ['\\Seen'], { uid: true });
      await client.logout();
      return { marked: uids.length, olderThan: date.toISOString() };
    }

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