mark_as_read
Mark email messages as read to manage your inbox and track which messages you have viewed using the iMail-mcp server.
Instructions
Mark email messages as read
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailbox | No | Mailbox name (default: INBOX) | INBOX |
| messageIds | Yes | Array of message IDs to mark as read |
Implementation Reference
- src/lib/icloud-mail-client.ts:383-415 (handler)Core handler implementation that marks all messages in the mailbox as read by adding the IMAP \\Seen flag (ignores specific messageIds)async markAsRead( _messageIds: string[], mailbox: string = 'INBOX' ): Promise<void> { return new Promise((resolve, reject) => { this.imap.openBox(mailbox, false, (err: Error) => { if (err) { reject(err); return; } this.imap.search(['ALL'], (err: Error, results: number[]) => { if (err) { reject(err); return; } if (!results || results.length === 0) { resolve(); return; } this.imap.addFlags(results, ['\\Seen'], (err: Error) => { if (err) { reject(err); return; } resolve(); }); }); }); }); }
- src/index.ts:444-465 (handler)MCP server dispatch handler for the 'mark_as_read' tool call, extracts arguments and invokes the mail client methodcase 'mark_as_read': { if (!mailClient) { throw new McpError( ErrorCode.InvalidRequest, 'iCloud Mail not configured. Please set ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables.' ); } const messageIds = args?.messageIds as string[]; const mailbox = (args?.mailbox as string) || 'INBOX'; await mailClient.markAsRead(messageIds, mailbox); return { content: [ { type: 'text', text: `Marked ${messageIds.length} messages as read`, }, ], }; }
- src/index.ts:110-129 (registration)Tool registration including name, description, and input schema definition in the ListTools response{ name: 'mark_as_read', description: 'Mark email messages as read', inputSchema: { type: 'object', properties: { messageIds: { type: 'array', items: { type: 'string' }, description: 'Array of message IDs to mark as read', }, mailbox: { type: 'string', description: 'Mailbox name (default: INBOX)', default: 'INBOX', }, }, required: ['messageIds'], }, },