Skip to main content
Glama

copy_email

Move email messages between folders in your mailbox. Specify source and target folders with message ID or UID to organize your email efficiently.

Instructions

Copy 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 implementation of the copy_email logic inside the EmailMove class.
    def copy_email(
        self, source_folder: str, uids: int | list[int], destination_folder: str
    ) -> bool:
        """
        Copy emails to another folder.
    
        Unlike move, this preserves the original emails.
    
        Args:
            source_folder: Source folder containing the emails
            uids: Email UID or list of UIDs to copy
            destination_folder: Destination folder
    
        Returns:
            True if successful
    
        Raises:
            EmailMoveError: If operation fails
    
        Example:
            >>> move = EmailMove(conn)
            >>> move.copy_email('INBOX', [1, 2], 'INBOX/Backup')
            True
        """
        if not source_folder:
            raise EmailMoveError("Source folder is required")
    
        if not destination_folder:
            raise EmailMoveError("Destination folder is required")
    
        # Select source folder
        self._select_folder(source_folder)
    
        uid_string = self._validate_uids(uids)
    
        try:
            response = self._conn.uid("COPY", uid_string, destination_folder)
    
            status = response[0]
            if status not in ("OK", b"OK") and not isinstance(status, int):
                error_msg = (
                    response[1][0].decode("utf-8", errors="replace")
                    if response[1] and response[1][0]
                    else "Unknown error"
                )
    
                if "does not exist" in error_msg.lower():
                    raise EmailMoveError(
                        f"Destination folder '{destination_folder}' does not exist"
                    )
    
                raise EmailMoveError(f"Failed to copy email: {error_msg}")
    
            return True
    
        except EmailMoveError:
            raise
        except Exception as e:
            raise EmailMoveError(f"Failed to copy 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 must carry full behavioral disclosure. It fails to clarify that the original email remains in the source folder (the key difference from move), whether the operation is idempotent, what the return value is (no output schema exists), or if duplicate UIDs are created.

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 appropriately brief and front-loaded with the action. However, extreme brevity comes at the cost of omitting crucial behavioral and contextual details needed for a mutation tool.

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?

For a mutation operation with 4 parameters, no annotations, and no output schema, the description is insufficient. It lacks explanation of the copy behavior, return values, and the mutual exclusivity of 'message_id' versus 'uid' parameters.

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 structured documentation already explains all four parameters adequately. The description adds no parameter-specific semantics, but the baseline score of 3 is appropriate since the schema carries the load.

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 uses a clear verb ('Copy') and resource ('email') with destination context ('to another folder'). However, it fails to distinguish from the sibling tool 'move_email', which is critical since both involve changing folder locations but differ in whether the original is preserved.

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 (particularly 'move_email'), nor does it mention prerequisites like requiring either 'message_id' or 'uid' as indicated by the schema's anyOf constraint.

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