Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

flag_email

Add custom flags to specific emails in IMAP mailboxes for better organization and categorization.

Instructions

Add flag to emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidsYesEmail UIDs
flagYesFlag name (e.g., \Flagged, \Important)
mailboxNoMailbox name (default: current)

Implementation Reference

  • The core implementation of flag_email, which handles the IMAP flag addition.
    def flag_email(
        self, uids: list[int], flag: str, mailbox: Optional[str] = None
    ) -> bool:
        """Add flag to emails."""
        self._ensure_connected()
        if mailbox:
            self.select_mailbox(mailbox)
        self.client.add_flags(uids, [flag.encode() if isinstance(flag, str) else flag])
        return True
  • Registration of the flag_email tool in the MCP server.
    make_tool(
        "flag_email",
        "Add flag to emails",
        {
            "uids": {
                "type": "array",
                "items": {"type": "number"},
                "description": "Email UIDs",
            },
            "flag": {"type": "string", "description": "Flag name (e.g., \\Flagged, \\Important)"},
            "mailbox": {"type": "string", "description": "Mailbox name (default: current)"},
        },
        ["uids", "flag"],
    ),
    make_tool(
  • The tool execution handler in the MCP server that calls the IMAP client method.
    elif name == "flag_email":
        return imap_client.flag_email(
            uids=args["uids"],
            flag=args["flag"],
            mailbox=args.get("mailbox"),
        )
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't cover critical aspects like whether this is a mutating operation, what permissions are required, how it affects email state, or error handling. This leaves significant gaps in understanding the tool's behavior.

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 at just four words, with zero wasted language. It's front-loaded with the core action and resource, making it immediately clear what the tool does without unnecessary elaboration.

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 mutating tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after flagging (e.g., success indicators, error responses), doesn't mention side effects, and provides minimal context about the operation's scope or limitations.

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?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional semantic context about parameters beyond what's in the schema, such as explaining flag naming conventions or mailbox selection implications, meeting the baseline for adequate 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?

The description clearly states the action ('Add flag') and target resource ('emails'), making the purpose immediately understandable. It doesn't differentiate from its sibling 'unflag_email' or specify what types of flags can be added, which prevents a perfect score.

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_flagged' or 'unflag_email'. It doesn't mention prerequisites, such as needing email UIDs from prior operations like 'fetch_emails' or 'search_emails', leaving usage context unclear.

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/Soundhannes/IMAP-MCP'

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