Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

search_by_date

Find emails within specific date ranges using ISO format dates to filter messages by when they were sent or received.

Instructions

Search emails by date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceNoEmails since date (ISO format)
beforeNoEmails before date (ISO format)
mailboxNoMailbox name (default: current)
limitNoMax results (default: 50)

Implementation Reference

  • The search_by_date method implementation, which builds IMAP search criteria based on since/before parameters and fetches the corresponding emails.
    def search_by_date(
        self,
        mailbox: Optional[str] = None,
        since: Optional[str] = None,
        before: Optional[str] = None,
        limit: int = 50,
    ) -> list[EmailHeader]:
        """Search emails by date range."""
        self._ensure_connected()
        if mailbox:
            self.select_mailbox(mailbox)
        elif not self.current_mailbox:
            self.select_mailbox("INBOX")
    
        criteria = []
        if since:
            criteria.extend(["SINCE", since])
        if before:
            criteria.extend(["BEFORE", before])
        if not criteria:
            criteria = ["ALL"]
    
        uids = self.client.search(criteria)
        uids = sorted(uids, reverse=True)[:limit]
        if not uids:
            return []
    
        messages = self.client.fetch(uids, ["ENVELOPE", "FLAGS", "RFC822.SIZE"])
        return [self._parse_email_header(uid, data) for uid, data in messages.items()]
  • Registration and dispatch logic for the search_by_date tool in the MCP server.
    elif name == "search_by_date":
        return imap_client.search_by_date(
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches emails by date range but doesn't reveal critical behaviors: whether it's read-only or mutative (though 'search' implies read-only), if it requires authentication, rate limits, pagination handling (beyond the 'limit' parameter), or what the output format looks like. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its operation.

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 a single, efficient sentence that front-loads the core functionality ('Search emails by date range') with zero wasted words. It's appropriately sized for a straightforward search tool, making it easy for an agent to parse quickly.

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 incomplete. It lacks details on behavioral traits (e.g., read-only nature, authentication needs), usage context versus siblings, and output expectations. While the schema covers parameters well, the overall context for safe and effective tool invocation is insufficient, especially without annotations to fill gaps.

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 input schema has 100% description coverage, with clear parameter definitions (e.g., 'since' and 'before' as ISO dates, 'mailbox' with default, 'limit' with default). The description adds no additional parameter semantics beyond what the schema provides—it doesn't explain date format nuances, mailbox selection implications, or result ordering. With high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Search') and resource ('emails'), and specifies the search criterion ('by date range'). It distinguishes itself from siblings like search_by_sender or search_by_subject by focusing on date-based filtering. However, it doesn't explicitly differentiate from the more generic 'search_emails' tool, which might also support date parameters.

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 whether it's for date-specific queries only, how it compares to 'search_emails' (which might handle broader searches), or any prerequisites like authentication. Without such context, the agent must infer usage from the tool name 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

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