move_email
Move an email to a different mailbox in Fastmail to organize messages by project, priority, or category.
Instructions
Move an email to a different mailbox
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | ID of the email to move | |
| targetMailboxId | Yes | ID of the target mailbox |
Implementation Reference
- src/index.ts:953-968 (handler)MCP tool handler for 'move_email': validates input parameters, initializes JmapClient, calls client.moveEmail, and returns success response.case 'move_email': { const { emailId, targetMailboxId } = args as any; if (!emailId || !targetMailboxId) { throw new McpError(ErrorCode.InvalidParams, 'emailId and targetMailboxId are required'); } const client = initializeClient(); await client.moveEmail(emailId, targetMailboxId); return { content: [ { type: 'text', text: 'Email moved successfully', }, ], }; }
- src/index.ts:435-451 (schema)Input schema and registration for the 'move_email' tool in the ListTools response.name: 'move_email', description: 'Move an email to a different mailbox', inputSchema: { type: 'object', properties: { emailId: { type: 'string', description: 'ID of the email to move', }, targetMailboxId: { type: 'string', description: 'ID of the target mailbox', }, }, required: ['emailId', 'targetMailboxId'], }, },
- src/jmap-client.ts:398-424 (handler)Core JmapClient method implementing email move via JMAP Email/set with updated mailboxIds.async moveEmail(emailId: string, targetMailboxId: string): Promise<void> { const session = await this.getSession(); const targetMailboxIds: Record<string, boolean> = {}; targetMailboxIds[targetMailboxId] = true; const request: JmapRequest = { using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'], methodCalls: [ ['Email/set', { accountId: session.accountId, update: { [emailId]: { mailboxIds: targetMailboxIds } } }, 'moveEmail'] ] }; const response = await this.makeRequest(request); const result = response.methodResponses[0][1]; if (result.notUpdated && result.notUpdated[emailId]) { throw new Error('Failed to move email.'); } }
- src/index.ts:1140-1140 (registration)Tool name listed in check_function_availability response for email functions.'get_recent_emails', 'mark_email_read', 'delete_email', 'move_email',