Skip to main content
Glama
ZilongXue

ClaudePost

by ZilongXue

count-daily-emails

Track email volume by counting emails received daily within a specified date range using YYYY-MM-DD format for start and end dates.

Instructions

Count emails received for each day in a date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
start_dateYesStart date in YYYY-MM-DD format

Implementation Reference

  • Main handler for 'count-daily-emails' tool. Loops through each day in the specified date range, counts emails received on that day using IMAP search '(ON "date")', and formats results as a table.
    elif name == "count-daily-emails":
        start_date = datetime.strptime(arguments["start_date"], "%Y-%m-%d")
        end_date = datetime.strptime(arguments["end_date"], "%Y-%m-%d")
        
        result_text = "Daily email counts:\n\n"
        result_text += "Date | Count\n"
        result_text += "-" * 30 + "\n"
        
        current_date = start_date
        while current_date <= end_date:
            date_str = current_date.strftime("%d-%b-%Y")
            search_criteria = f'(ON "{date_str}")'
            
            try:
                async with asyncio.timeout(SEARCH_TIMEOUT):
                    count = await count_emails_async(mail, search_criteria)
                    result_text += f"{current_date.strftime('%Y-%m-%d')} | {count}\n"
            except asyncio.TimeoutError:
                result_text += f"{current_date.strftime('%Y-%m-%d')} | Timeout\n"
            
            current_date += timedelta(days=1)
        
        return [types.TextContent(
            type="text",
            text=result_text
        )]
  • JSON Schema defining the input parameters for the count-daily-emails tool: requires start_date and end_date as strings in YYYY-MM-DD format.
        "type": "object",
        "properties": {
            "start_date": {
                "type": "string",
                "description": "Start date in YYYY-MM-DD format",
            },
            "end_date": {
                "type": "string",
                "description": "End date in YYYY-MM-DD format",
            },
        },
        "required": ["start_date", "end_date"],
    },
  • Registration of the 'count-daily-emails' tool within the handle_list_tools function, including name, description, and input schema.
    types.Tool(
        name="count-daily-emails",
        description="Count emails received for each day in a date range",
        inputSchema={
            "type": "object",
            "properties": {
                "start_date": {
                    "type": "string",
                    "description": "Start date in YYYY-MM-DD format",
                },
                "end_date": {
                    "type": "string",
                    "description": "End date in YYYY-MM-DD format",
                },
            },
            "required": ["start_date", "end_date"],
        },
    ),
  • Helper function that performs the actual IMAP search and counts the number of matching emails. Used by the count-daily-emails handler for each day.
    async def count_emails_async(mail: imaplib.IMAP4_SSL, search_criteria: str) -> int:
        """Asynchronously count emails matching the search criteria."""
        loop = asyncio.get_event_loop()
        try:
            _, messages = await loop.run_in_executor(None, lambda: mail.search(None, search_criteria))
            return len(messages[0].split()) if messages[0] else 0
        except Exception as e:
            raise Exception(f"Error counting emails: {str(e)}")
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 counts emails per day in a date range, implying a read-only operation, but lacks details on permissions, rate limits, output format (e.g., structured data vs. raw count), or error handling. This leaves significant gaps for a tool with no annotation coverage.

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 with zero waste. It is front-loaded with the core purpose and appropriately sized for the tool's simplicity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose but lacks usage guidelines, behavioral details, and output information, which are needed for full contextual understanding despite the simple schema.

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, clearly documenting both parameters (start_date and end_date) with format details. The description adds minimal value beyond the schema by implying date-range filtering but does not provide additional context like timezone handling or inclusive/exclusive bounds. Baseline 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 ('Count') and resource ('emails'), specifying the temporal scope ('for each day in a date range'). It distinguishes itself from siblings like 'get-email-content' (which retrieves content) and 'send-email' (which sends emails), but does not explicitly differentiate from 'search-emails' (which might also involve counting).

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 does not mention prerequisites, exclusions, or compare it to sibling tools like 'search-emails', which might offer similar functionality with different scopes or outputs.

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

Related 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/ZilongXue/claude-post'

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