Skip to main content
Glama

list_emails

Retrieve emails from a specified Outlook folder using a Microsoft MCP server. Configure account ID, folder, limit, and body inclusion for precise email listing.

Instructions

List emails from specified folder

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
folderNoinbox
include_bodyNo
limitNo

Implementation Reference

  • The handler function for the 'list_emails' tool. It lists emails from a specified Microsoft mail folder using the Microsoft Graph API, with options for folder, limit, and whether to include body content.
    @mcp.tool
    def list_emails(
        account_id: str,
        folder: str = "inbox",
        limit: int = 10,
        include_body: bool = True,
    ) -> list[dict[str, Any]]:
        """List emails from specified folder"""
        folder_path = FOLDERS.get(folder.casefold(), folder)
    
        if include_body:
            select_fields = "id,subject,from,toRecipients,ccRecipients,receivedDateTime,hasAttachments,body,conversationId,isRead"
        else:
            select_fields = "id,subject,from,toRecipients,receivedDateTime,hasAttachments,conversationId,isRead"
    
        params = {
            "$top": min(limit, 100),
            "$select": select_fields,
            "$orderby": "receivedDateTime desc",
        }
    
        emails = list(
            graph.request_paginated(
                f"/me/mailFolders/{folder_path}/messages",
                account_id,
                params=params,
                limit=limit,
            )
        )
    
        return emails
  • Helper dictionary mapping user-friendly folder names to Microsoft Graph API folder paths, used by the list_emails handler.
    FOLDERS = {
        k.casefold(): v
        for k, v in {
            "inbox": "inbox",
            "sent": "sentitems",
            "drafts": "drafts",
            "deleted": "deleteditems",
            "junk": "junkemail",
            "archive": "archive",
        }.items()
    }
  • Creation of the FastMCP instance where tools like list_emails are registered via decorators.
    mcp = FastMCP("microsoft-mcp")
  • Import of the MCP instance from tools.py, which triggers registration of all decorated tools including list_emails, and runs the server.
    from .tools import mcp
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 offers minimal information. It doesn't describe whether this is a read-only operation, how results are ordered, pagination behavior, error conditions, or rate limits. The description only states what it does, not how it behaves.

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 extremely concise—a single, clear sentence with no wasted words. It's front-loaded with the core purpose, though this brevity comes at the cost of detail. Every word earns its place by directly stating the tool's function.

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 tool's moderate complexity (4 parameters, no output schema, no annotations), the description is inadequate. It lacks essential context such as return format, error handling, authentication requirements, and differentiation from siblings like 'search_emails'. The agent would struggle to use this tool effectively based solely on the description.

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?

The description mentions 'specified folder', which loosely relates to the 'folder' parameter, but adds no meaningful semantics beyond what the schema's titles provide. With 0% schema description coverage, the description doesn't compensate by explaining parameter purposes, formats, or constraints, though it doesn't contradict the schema either.

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 ('List') and resource ('emails from specified folder'), making the purpose immediately understandable. It distinguishes itself from other email-related tools like 'get_email' (single email) and 'search_emails' (filtered search), though it doesn't explicitly mention these siblings.

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 'search_emails' or 'get_email'. It doesn't mention prerequisites (e.g., authentication), typical use cases, or limitations, leaving the agent to infer usage from context 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

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