mark_email_read
Mark emails as read or unread to manage your inbox by updating email status using the Fastmail MCP Server.
Instructions
Mark an email as read or unread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | ID of the email to mark | |
| read | No | true to mark as read, false to mark as unread |
Implementation Reference
- src/index.ts:919-934 (handler)MCP CallToolRequest handler case for 'mark_email_read': validates input, initializes JmapClient, calls client.markEmailRead(), and returns success response.case 'mark_email_read': { const { emailId, read = true } = args as any; if (!emailId) { throw new McpError(ErrorCode.InvalidParams, 'emailId is required'); } const client = initializeClient(); await client.markEmailRead(emailId, read); return { content: [ { type: 'text', text: `Email ${read ? 'marked as read' : 'marked as unread'} successfully`, }, ], }; }
- src/index.ts:401-419 (schema)Tool schema definition in ListTools response, including name, description, and inputSchema with emailId (required) and read (boolean, default true).{ name: 'mark_email_read', description: 'Mark an email as read or unread', inputSchema: { type: 'object', properties: { emailId: { type: 'string', description: 'ID of the email to mark', }, read: { type: 'boolean', description: 'true to mark as read, false to mark as unread', default: true, }, }, required: ['emailId'], }, },
- src/jmap-client.ts:335-360 (helper)JmapClient method that implements marking email read/unread via JMAP Email/set with $seen keyword, called by the MCP handler.async markEmailRead(emailId: string, read: boolean = true): Promise<void> { const session = await this.getSession(); const keywords = read ? { $seen: true } : {}; const request: JmapRequest = { using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'], methodCalls: [ ['Email/set', { accountId: session.accountId, update: { [emailId]: { keywords } } }, 'updateEmail'] ] }; const response = await this.makeRequest(request); const result = response.methodResponses[0][1]; if (result.notUpdated && result.notUpdated[emailId]) { throw new Error(`Failed to mark email as ${read ? 'read' : 'unread'}.`); } }
- src/index.ts:1140-1143 (registration)Tool listed in check_function_availability response under email functions.'get_recent_emails', 'mark_email_read', 'delete_email', 'move_email', 'get_email_attachments', 'download_attachment', 'advanced_search', 'get_thread', 'get_mailbox_stats', 'get_account_summary', 'bulk_mark_read', 'bulk_move', 'bulk_delete' ]