Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

move_email

Move an email to a different mailbox by specifying the email ID and target mailbox ID.

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

  • src/index.ts:659-676 (registration)
    Registration of the 'move_email' tool in the ListTools handler, defining its name, description, and input schema (emailId and targetMailboxId, both required).
    {
      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'],
      },
    },
  • Handler for the 'move_email' tool in the CallToolRequestSchema switch statement. Validates required params, calls JmapClient.moveEmail(), and returns success message.
    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',
          },
        ],
      };
    }
  • Core JMAP implementation of moveEmail. Fetches current mailboxIds, builds a patch to remove the email from all current mailboxes and add it to the target mailbox, then sends an Email/set update.
    async moveEmail(emailId: string, targetMailboxId: string): Promise<void> {
      const session = await this.getSession();
    
      // Fetch current mailboxIds to build a proper JMAP patch
      const getRequest: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/get', {
            accountId: session.accountId,
            ids: [emailId],
            properties: ['mailboxIds']
          }, 'getEmail']
        ]
      };
      const getResponse = await this.makeRequest(getRequest);
      const email = this.getListResult(getResponse, 0)[0];
    
      // Build patch: remove from all current mailboxes, add to target
      const patch: Record<string, boolean | null> = {};
      if (email?.mailboxIds) {
        for (const mbId of Object.keys(email.mailboxIds)) {
          patch[`mailboxIds/${mbId}`] = null;
        }
      }
      patch[`mailboxIds/${targetMailboxId}`] = true;
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/set', {
            accountId: session.accountId,
            update: {
              [emailId]: patch
            }
          }, 'moveEmail']
        ]
      };
    
      const response = await this.makeRequest(request);
      const result = this.getMethodResult(response, 0);
    
      if (result.notUpdated && result.notUpdated[emailId]) {
        throw new Error('Failed to move email.');
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose behavioral traits such as permissions needed, side effects (e.g., label handling), or whether the operation is reversible.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise with a single sentence. It gets straight to the point but lacks structuring like prerequisites or post-conditions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple operation with 2 parameters, the description is minimally adequate. However, it does not explain return values or what happens to the original email (e.g., is it a copy or move?).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema already describes both parameters with 100% coverage. The description adds no additional meaning beyond the schema, so baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action (move) and resource (email) with a specific destination (different mailbox). It distinguishes from siblings like delete_email, bulk_move, and mark_read.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like bulk_move. The description does not mention any prerequisites, context, or scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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