Skip to main content
Glama

bulk_mark_read

Mark multiple emails as read or unread in Fastmail to manage your inbox efficiently. Specify email IDs and desired read status to organize messages.

Instructions

Mark multiple emails as read/unread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdsYesArray of email IDs to mark
readNotrue to mark as read, false as unread

Implementation Reference

  • MCP server tool handler for 'bulk_mark_read': validates input parameters, initializes JmapClient, calls bulkMarkRead method, and returns success response.
    case 'bulk_mark_read': { const { emailIds, read = true } = args as any; if (!emailIds || !Array.isArray(emailIds) || emailIds.length === 0) { throw new McpError(ErrorCode.InvalidParams, 'emailIds array is required and must not be empty'); } const client = initializeClient(); await client.bulkMarkRead(emailIds, read); return { content: [ { type: 'text', text: `${emailIds.length} emails ${read ? 'marked as read' : 'marked as unread'} successfully`, }, ], }; }
  • Tool schema definition for 'bulk_mark_read' including input schema for emailIds (required array of strings) and read (boolean, default true). Used for both registration in ListTools and validation.
    name: 'bulk_mark_read', description: 'Mark multiple emails as read/unread', inputSchema: { type: 'object', properties: { emailIds: { type: 'array', items: { type: 'string' }, description: 'Array of email IDs to mark', }, read: { type: 'boolean', description: 'true to mark as read, false as unread', default: true, }, }, required: ['emailIds'], }, },
  • Core implementation of bulkMarkRead in JmapClient: constructs JMAP Email/set request to update 'keywords' ($seen) for multiple email IDs in batch, sends request, checks for failures.
    async bulkMarkRead(emailIds: string[], read: boolean = true): Promise<void> { const session = await this.getSession(); const keywords = read ? { $seen: true } : {}; const updates: Record<string, any> = {}; emailIds.forEach(id => { updates[id] = { keywords }; }); const request: JmapRequest = { using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'], methodCalls: [ ['Email/set', { accountId: session.accountId, update: updates }, 'bulkUpdate'] ] }; const response = await this.makeRequest(request); const result = response.methodResponses[0][1]; if (result.notUpdated && Object.keys(result.notUpdated).length > 0) { throw new Error('Failed to update some emails.'); } }
  • Usage example of bulkMarkRead in test_bulk_operations tool, demonstrating parameters and execution.
    await client.bulkMarkRead(operation.parameters.emailIds, operation.parameters.read); results.operations.push({
  • src/index.ts:1142-1143 (registration)
    Reference to 'bulk_mark_read' in the list of available email functions in check_function_availability response.
    'get_mailbox_stats', 'get_account_summary', 'bulk_mark_read', 'bulk_move', 'bulk_delete' ]

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/MadLlama25/fastmail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server