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"),
        )

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