Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

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
NameRequiredDescriptionDefault
emailIdYesID of the email to move
targetMailboxIdYesID of the target mailbox

Implementation Reference

  • 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',
          },
        ],
      };
    }
  • 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'],
      },
    },
  • 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',

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