Skip to main content
Glama

move_email

Move email messages between folders to organize your inbox. Specify source and target folders with message ID or UID for precise email management.

Instructions

Move email to another folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_folderYesSource folder name
target_folderYesTarget folder name
message_idNoMessage ID (sequence number)
uidNoUnique ID of the message

Implementation Reference

  • The actual logic for moving emails is implemented in the EmailMove.move_email method in src/mail_mcp/operations/move.py, which attempts an IMAP MOVE command with a fallback to COPY and DELETE if MOVE is not supported.
    def move_email(
        self, source_folder: str, uids: int | list[int], destination_folder: str
    ) -> bool:
        """
        Move emails from one folder to another.
    
        Uses IMAP MOVE command (RFC 6851) if available,
        otherwise falls back to copy + delete.
    
        Args:
            source_folder: Source folder containing the emails
            uids: Email UID or list of UIDs to move
            destination_folder: Destination folder
    
        Returns:
            True if successful
    
        Raises:
            EmailMoveError: If operation fails
    
        Example:
            >>> move = EmailMove(conn)
            >>> move.move_email('INBOX', [1, 2, 3], 'INBOX/Archive')
            True
        """
        if not source_folder:
            raise EmailMoveError("Source folder is required")
    
        if not destination_folder:
            raise EmailMoveError("Destination folder is required")
    
        if source_folder == destination_folder:
            raise EmailMoveError("Source and destination folders must be different")
    
        # Select source folder to get current state
        self._select_folder(source_folder)
    
        uid_string = self._validate_uids(uids)
    
        try:
            # Try MOVE command first (IMAP4rev2)
            response = self._conn.uid("MOVE", uid_string, destination_folder)
    
            if response[0] == b"OK":
                return True
    
            # If MOVE not supported, fall back to COPY + STORE +DELETED
            return self._move_fallback(source_folder, uids, destination_folder)
    
        except Exception as e:
            # Try fallback method
            try:
                return self._move_fallback(source_folder, uids, destination_folder)
            except EmailMoveError:
                raise EmailMoveError(f"Failed to move email: {str(e)}")
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. While 'move' implies the email is removed from the source folder, the description does not explicitly confirm this destructive behavior, nor does it mention error conditions (e.g., target folder not existing) or permission requirements.

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 single sentence is efficient and front-loaded with no wasted words. However, given the tool's complexity (4 parameters with conditional logic), the description borders on under-specification rather than optimal conciseness.

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?

Inadequate for a mutation tool with complex parameter logic (anyOf constraint) and no output schema or annotations. The description should explain the identifier choice (message_id vs uid) and confirm the destructive nature of the move operation to be complete.

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?

With 100% schema description coverage, the baseline score applies. The description does not add semantic clarification beyond the schema (e.g., explaining the difference between 'message_id' and 'uid' or providing examples), but it is not required to given the comprehensive schema coverage.

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?

States a clear verb-resource combination ('Move email to another folder') that accurately describes the operation. However, it fails to distinguish from the sibling 'copy_email' tool, which performs a superficially similar action but with different source-preservation behavior.

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?

Provides no guidance on when to use this tool versus 'copy_email' or other alternatives. Does not explain the logical constraint requiring either 'message_id' OR 'uid' (not both), leaving the agent to infer this from the schema's anyOf block alone.

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/AdJIa/mail-mcp-server'

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