Skip to main content
Glama
Racimy

iMail-mcp

move_messages

Transfer email messages between different mailboxes to organize your iCloud email storage effectively.

Instructions

Move messages between mailboxes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationMailboxYesDestination mailbox name
messageIdsYesArray of message IDs to move
sourceMailboxYesSource mailbox name

Implementation Reference

  • src/index.ts:174-196 (registration)
    Registration of the move_messages tool in the ListTools response, including name, description, and input schema.
    {
      name: 'move_messages',
      description: 'Move messages between mailboxes',
      inputSchema: {
        type: 'object',
        properties: {
          messageIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of message IDs to move',
          },
          sourceMailbox: {
            type: 'string',
            description: 'Source mailbox name',
          },
          destinationMailbox: {
            type: 'string',
            description: 'Destination mailbox name',
          },
        },
        required: ['messageIds', 'sourceMailbox', 'destinationMailbox'],
      },
    },
  • MCP server handler for calling the move_messages tool: checks connection, extracts parameters, invokes iCloudMailClient.moveMessages, and returns JSON response.
    case 'move_messages': {
      if (!mailClient) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          'iCloud Mail not configured. Please set ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables.'
        );
      }
    
      const messageIds = args?.messageIds as string[];
      const sourceMailbox = args?.sourceMailbox as string;
      const destinationMailbox = args?.destinationMailbox as string;
    
      const result = await mailClient.moveMessages(
        messageIds,
        sourceMailbox,
        destinationMailbox
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of moveMessages in iCloudMailClient: opens source mailbox, searches all messages, moves them to destination using IMAP.
    async moveMessages(
      _messageIds: string[],
      sourceMailbox: string,
      destinationMailbox: string
    ): Promise<{ status: string; message: string }> {
      return new Promise((resolve) => {
        this.imap.openBox(sourceMailbox, false, (err: Error) => {
          if (err) {
            resolve({
              status: 'error',
              message: `Failed to open source mailbox '${sourceMailbox}': ${err.message}`,
            });
            return;
          }
    
          // Search for all messages to get sequence numbers
          this.imap.search(['ALL'], (err: Error, results: number[]) => {
            if (err) {
              resolve({
                status: 'error',
                message: `Failed to search messages: ${err.message}`,
              });
              return;
            }
    
            if (!results || results.length === 0) {
              resolve({
                status: 'error',
                message: 'No messages found in source mailbox',
              });
              return;
            }
    
            // Use the sequence numbers for moving
            this.imap.move(results, destinationMailbox, (err: Error) => {
              if (err) {
                resolve({
                  status: 'error',
                  message: `Failed to move messages: ${err.message}`,
                });
                return;
              }
    
              resolve({
                status: 'success',
                message: `Successfully moved ${results.length} messages from '${sourceMailbox}' to '${destinationMailbox}'`,
              });
            });
          });
        });
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Move messages between mailboxes' implies a mutation operation, but it doesn't disclose critical traits such as whether the move is permanent, if it requires specific permissions, what happens to the source messages (e.g., deletion or copying), or potential side effects like updating message IDs. This leaves significant gaps for an agent to understand the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resources, making it easy to parse quickly. Every word earns its place without redundancy or unnecessary elaboration.

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

Completeness2/5

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

Given the complexity of a mutation tool with no annotations and no output schema, the description is insufficiently complete. It lacks details on behavioral traits (e.g., permanence, permissions), error conditions, or what the tool returns. For a tool that modifies data, this leaves the agent with significant uncertainty about how to use it correctly.

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 description coverage is 100%, with clear descriptions for all three parameters (sourceMailbox, destinationMailbox, messageIds). The description doesn't add any meaning beyond what the schema provides, such as explaining mailbox naming conventions or message ID formats. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description 'Move messages between mailboxes' clearly states the action (move) and the resources (messages, mailboxes), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'delete_messages' or 'set_flags' which also manipulate messages, so it doesn't reach the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., mailboxes must exist), exclusions (e.g., cannot move to non-existent mailboxes), or comparisons to siblings like 'delete_messages' or 'set_flags' for different operations on messages.

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/Racimy/iMail-mcp'

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