Skip to main content
Glama

move_email

Transfer emails to specified folders using the Microsoft MCP server. Define email ID, destination folder, and account ID to organize Outlook emails efficiently.

Instructions

Move email to another folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
destination_folderYes
email_idYes

Implementation Reference

  • Implements the move_email tool by resolving the destination folder ID from mail folders and using Microsoft Graph API to move the specified email.
    def move_email(
        email_id: str, destination_folder: str, account_id: str
    ) -> dict[str, Any]:
        """Move email to another folder"""
        folder_path = FOLDERS.get(destination_folder.casefold(), destination_folder)
    
        folders = graph.request("GET", "/me/mailFolders", account_id)
        folder_id = None
    
        if not folders:
            raise ValueError("Failed to retrieve mail folders")
        if "value" not in folders:
            raise ValueError(f"Unexpected folder response structure: {folders}")
    
        for folder in folders["value"]:
            if folder["displayName"].lower() == folder_path.lower():
                folder_id = folder["id"]
                break
    
        if not folder_id:
            raise ValueError(f"Folder '{destination_folder}' not found")
    
        payload = {"destinationId": folder_id}
        result = graph.request(
            "POST", f"/me/messages/{email_id}/move", account_id, json=payload
        )
        if not result:
            raise ValueError("Failed to move email - no response from server")
        if "id" not in result:
            raise ValueError(f"Failed to move email - unexpected response: {result}")
        return {"status": "moved", "new_id": result["id"]}
  • Mapping of common folder names to Microsoft Graph folder paths, used in move_email to resolve destination_folder.
    FOLDERS = {
        k.casefold(): v
        for k, v in {
            "inbox": "inbox",
            "sent": "sentitems",
            "drafts": "drafts",
            "deleted": "deleteditems",
            "junk": "junkemail",
            "archive": "archive",
        }.items()
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on permissions, side effects (e.g., whether the email is removed from the source folder), error handling, or response format. This leaves critical operational aspects unspecified for a mutation tool.

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, direct sentence with no wasted words, making it easy to parse quickly. It efficiently conveys the core action without unnecessary elaboration, though this brevity contributes to gaps in other dimensions.

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 tool with 3 undocumented parameters, no annotations, and no output schema, the description is insufficient. It lacks details on behavior, parameter usage, and expected outcomes, leaving too much undefined for reliable agent operation in a context with many sibling tools.

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

Parameters2/5

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

The schema description coverage is 0%, meaning none of the three parameters (account_id, destination_folder, email_id) are documented in the schema. The description adds no semantic information about these parameters, such as what format they expect or where to obtain them, failing to compensate for the schema's lack of documentation.

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 clearly states the action ('move') and resource ('email') with the destination ('to another folder'), making the purpose immediately understandable. However, it doesn't differentiate from potential siblings like 'delete_email' or 'update_email' which might also involve email manipulation, leaving room for ambiguity in tool selection.

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 like 'delete_email' or 'update_email', nor does it mention prerequisites such as needing an authenticated account or valid email/folder IDs. Without this context, an agent might struggle to apply it correctly in complex 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

Related 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/elyxlz/microsoft-mcp'

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