Skip to main content
Glama
p-l-ta

mail-mcp

by p-l-ta

move_email

Moves a message to a destination mailbox using its RFC message-ID. Requires the exact mailbox name from list_accounts_and_mailboxes.

Instructions

Move a message to a different mailbox by RFC message-id. Use list_accounts_and_mailboxes to get exact mailbox names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesRFC message-id (with or without angle brackets)
destination_mailboxYesExact mailbox name from list_accounts_and_mailboxes (slash-pathed for nested, e.g. 'Folders/Amtrak')
destination_accountNoAccount name to disambiguate if multiple accounts share the mailbox name

Implementation Reference

  • The main handler function that registers the 'move_email' tool on the MCP server. It receives message_id, destination_mailbox, and optional destination_account, then calls findMessageAndAct with an AppleScript action that moves the found message to the target mailbox.
    export function register(server: McpServer): void {
      server.tool(
        "move_email",
        "Move a message to a different mailbox by RFC message-id. Use list_accounts_and_mailboxes to get exact mailbox names.",
        schema,
        { title: "Move Email", readOnlyHint: false, destructiveHint: false },
        async ({ message_id, destination_mailbox, destination_account }) => {
          const result = await findMessageAndAct({
            messageId: message_id,
            action: ACTION,
            extraArgs: {
              destMailbox: destination_mailbox,
              destAcct: destination_account ?? "",
            },
          });
          if (result === MESSAGE_NOT_FOUND) {
            return {
              content: [{ type: "text", text: `No message found with id ${message_id}` }],
              isError: true,
            };
          }
          return { content: [{ type: "text", text: result }] };
        },
      );
    }
  • Input schema for move_email tool: message_id (required string), destination_mailbox (required string), destination_account (optional string).
    const schema = {
      message_id: z.string().describe("RFC message-id (with or without angle brackets)"),
      destination_mailbox: z.string().describe("Exact mailbox name from list_accounts_and_mailboxes (slash-pathed for nested, e.g. 'Folders/Amtrak')"),
      destination_account: z.string().optional().describe("Account name to disambiguate if multiple accounts share the mailbox name"),
    };
  • The AppleScript snippet executed to perform the move. After findMessageAndAct binds the found message to 'foundMsg', this script searches accounts for the destination mailbox and moves the message.
    const ACTION = `
      set destMb to missing value
      repeat with acct in accounts
        if destAcct is "" or (name of acct) contains destAcct then
          try
            set destMb to mailbox destMailbox of acct
            exit repeat
          end try
        end if
      end repeat
      if destMb is missing value then return "destination not found"
    
      move foundMsg to destMb
      return "ok"
    `;
  • src/server.ts:12-18 (registration)
    Import and registration of the move_email tool in the main server file.
    import { register as registerMove } from "./tools/move.js";
    import { register as registerTrash } from "./tools/trash.js";
    import { register as registerCreateMailbox } from "./tools/create_mailbox.js";
    import { register as registerBulkMarkRead } from "./tools/bulk_mark_read.js";
    import { register as registerGetUnsubscribeLink } from "./tools/get_unsubscribe_link.js";
    import { register as registerListSenders } from "./tools/list_senders.js";
    import { register as registerEmptyMailbox } from "./tools/empty_mailbox.js";
Behavior2/5

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

Annotations already indicate readOnlyHint=false and destructiveHint=false. The description adds no additional behavioral context beyond what is in the annotations and parameter schema (e.g., no mention of whether flags are preserved, if the move is reversible, or what happens to the original message).

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 consists of two clear, front-loaded sentences without any superfluous text. Every word serves a purpose.

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?

While the description covers the basic action and parameter hints, it does not explain the return value or side effects (e.g., whether the move is synchronous, if flags transfer, etc.). Without an output schema, some additional context would be beneficial, but the description is minimally adequate for a straightforward tool.

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

Parameters4/5

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

All parameters have schema descriptions (100% coverage), so baseline is 3. The description adds value by instructing users to use list_accounts_and_mailboxes to get valid mailbox names, which directly helps with the destination_mailbox parameter. This extra guidance justifies a 4.

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?

Description clearly states the verb 'move', resource 'message', and the method 'by RFC message-id'. It uniquely identifies the tool's function among siblings such as trash_email or set_message_flags.

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

Usage Guidelines3/5

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

The description gives a prerequisite hint to use list_accounts_and_mailboxes for mailbox names, but does not explicitly state when to use this tool versus alternatives like trash_email or set_message_flags. It lacks clear when-not-to-use guidance.

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/p-l-ta/mail-mcp'

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