Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

unflag_email

Remove flags from specific emails in IMAP mailboxes to organize and declutter your inbox by clearing markers like read, important, or custom labels.

Instructions

Remove flag from emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidsYesEmail UIDs
flagYesFlag name to remove
mailboxNoMailbox name (default: current)

Implementation Reference

  • The core logic for removing a flag from an email in the IMAP client.
    def unflag_email(
        self, uids: list[int], flag: str, mailbox: Optional[str] = None
    ) -> bool:
        """Remove flag from emails."""
        self._ensure_connected()
        if mailbox:
            self.select_mailbox(mailbox)
        self.client.remove_flags(uids, [flag.encode() if isinstance(flag, str) else flag])
        return True
  • The definition and schema for the unflag_email MCP tool.
    make_tool(
        "unflag_email",
        "Remove flag from emails",
        {
            "uids": {
                "type": "array",
                "items": {"type": "number"},
                "description": "Email UIDs",
            },
            "flag": {"type": "string", "description": "Flag name to remove"},
            "mailbox": {"type": "string", "description": "Mailbox name (default: current)"},
        },
        ["uids", "flag"],
    ),
  • The registration/dispatch logic that maps the unflag_email MCP tool name to the imap_client handler.
    elif name == "unflag_email":
        return imap_client.unflag_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. While 'Remove flag' implies a mutation operation, it doesn't specify permissions required, whether the operation is reversible, what happens if flags don't exist, or any rate limits. For a tool that modifies email state, this leaves significant behavioral gaps.

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 maximally concise - a single four-word phrase that communicates the core functionality without any wasted words. It's appropriately sized for this straightforward operation and gets directly to the point.

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 no annotations and no output schema, the description is insufficient. It doesn't explain what happens after flag removal, whether there are side effects, what permissions are needed, or how to verify success. The context demands more complete behavioral information than provided.

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%, providing complete parameter documentation. The description adds no additional parameter semantics beyond what's in the schema. The baseline score of 3 reflects adequate but minimal value addition from the description regarding parameters.

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 ('Remove flag') and target resource ('from emails'), making the tool's purpose immediately understandable. However, it doesn't differentiate from its sibling 'flag_email' beyond the opposite action, missing an opportunity to clarify the relationship between these complementary operations.

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. It doesn't mention prerequisites (like needing flagged emails), exclusions, or relationships with sibling tools like 'flag_email', 'search_flagged', or 'mark_read/unread' that might be relevant in email management workflows.

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