Skip to main content
Glama
seandkendall

productivity-mcp

by seandkendall

list_recent_senders

Identifies top email senders over a specified period, ordered by message count. Answers 'who has been emailing me lately?'

Instructions

Top senders over the last N days, ordered by message count. Useful for "who has been emailing me lately?" style questions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNo
folderNoINBOX
since_daysNo
topNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the 'list_recent_senders' tool. It retrieves up to 1000 messages from a folder (default INBOX) within the last N days (default 30), counts messages per sender, and returns the top senders (default 20) sorted by message count descending.
    def list_recent_senders(
        account: str | None = None,
        folder: str = "INBOX",
        since_days: int = 30,
        top: int = 20,
    ) -> list[dict[str, Any]]:
        """Top senders over the last N days, ordered by message count. Useful for
        "who has been emailing me lately?" style questions."""
        msgs = _email(account).list_messages(folder=folder, limit=1000, since_days=since_days)
        counts: dict[str, int] = {}
        for m in msgs:
            counts[m.sender] = counts.get(m.sender, 0) + 1
        ranked = sorted(counts.items(), key=lambda kv: -kv[1])[:top]
        return [{"sender": s, "count": c} for s, c in ranked]
  • Tool registration via @mcp.tool() decorator on the list_recent_senders function. This is how the tool is registered with the FastMCP server.
    @mcp.tool()
    @_logged
  • Input schema defined via function signature (account, folder, since_days, top) and return type annotation (list[dict[str, Any]]).
    def list_recent_senders(
        account: str | None = None,
        folder: str = "INBOX",
        since_days: int = 30,
        top: int = 20,
    ) -> list[dict[str, Any]]:
  • The _email() helper function resolves the account name to an EmailProvider instance, used by list_recent_senders to call list_messages().
    def _email(account: str | None) -> EmailProvider:
        if not _email_providers:
            raise RuntimeError("No email accounts configured. See example.config.toml.")
        if account is None:
            return next(iter(_email_providers.values()))
        if account not in _email_providers:
            raise KeyError(f"Unknown email account: {account}. Available: {list(_email_providers)}")
        return _email_providers[account]
  • The abstract list_messages method on EmailProvider that list_recent_senders calls internally.
    def list_messages(
        self,
        folder: str = "INBOX",
        limit: int = 25,
        query: str | None = None,
        unread_only: bool = False,
        recipients: list[str] | None = None,
        since_days: int | None = None,
        senders: list[str] | None = None,
    ) -> list[EmailMessage]: ...
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It states that results are ordered by message count and limited to a recent window, which is helpful. However, it does not mention direction (descending), inclusion of current user, or pagination. The description is adequate but not comprehensive.

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 two sentences (140 characters) and clearly communicates the core purpose. It is front-loaded with the key action and result. No unnecessary words.

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 has 4 parameters, no annotations, and only a brief description, the description fails to provide enough context for proper use. Missing details include parameter semantics, behavioral traits (order, data range limits), and how results are structured. The existence of an output schema partially mitigates this, but the description itself is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 4 parameters with 0% description coverage. The description does not mention any parameters or their roles. The agent must infer from parameter names (e.g., 'since_days' for time window, 'top' for count). This leaves significant ambiguity, especially for 'account' and 'folder'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists top senders over a time window ordered by message count, and gives a concrete use case ('who has been emailing me lately?'). This distinguishes it from siblings like list_emails (individual emails) or search_emails_by_sender (specific sender).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions a use case ('who has been emailing me lately?') but does not specify when not to use it or compare to alternatives like search_emails_by_sender or count_emails. Guidance is minimal but not misleading.

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/seandkendall/productivity-mcp'

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