Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

get_total_count

Count total emails in an IMAP mailbox to monitor message volume or track email activity. Specify a mailbox name or use the default INBOX.

Instructions

Get total email count in mailbox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mailboxNoMailbox name (default: INBOX)

Implementation Reference

  • Actual implementation of get_total_count in the IMAP client class.
    def get_total_count(self, mailbox: str = "INBOX") -> int:
        """Get total email count in mailbox."""
        self._ensure_connected()
        status = self.client.folder_status(mailbox, ["MESSAGES"])
        return status.get(b"MESSAGES", 0)
  • MCP tool definition for get_total_count.
    make_tool(
        "get_total_count",
        "Get total email count in mailbox",
        {
            "mailbox": {"type": "string", "description": "Mailbox name (default: INBOX)"},
        },
    ),
  • MCP tool handler dispatching to the client implementation.
    elif name == "get_total_count":
        return imap_client.get_total_count(
            mailbox=args.get("mailbox", "INBOX"),
        )

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