Skip to main content
Glama

gmail_inbox_stats

Retrieve current Gmail inbox statistics including total messages, unread count, starred messages, and important messages for inbox management.

Instructions

Get current inbox statistics including total messages, unread count, starred count, and important message count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the gmail_inbox_stats tool in the MCP server with its schema (no input parameters).
    Tool(
        name="gmail_inbox_stats",
        description="Get current inbox statistics (unread count, starred, etc.)",
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
    Tool(
  • Tool handler in call_tool() that executes get_inbox_stats() on GmailClient and returns formatted TextContent.
    elif name == "gmail_inbox_stats":
        stats = await client.get_inbox_stats()
        return [
            TextContent(
                type="text",
                text=_format_inbox_stats(stats),
            )
        ]
  • Core implementation of inbox statistics retrieval using Gmail API queries for unread, starred, important, and total message counts in inbox.
    async def get_inbox_stats(self) -> InboxStats:
        """Get current inbox statistics."""
        try:
            # Get counts
            unread = (
                self.service.users()
                .messages()
                .list(userId="me", q="is:unread in:inbox", maxResults=1)
                .execute()
            ).get("resultSizeEstimate", 0)
    
            starred = (
                self.service.users()
                .messages()
                .list(userId="me", q="is:starred", maxResults=1)
                .execute()
            ).get("resultSizeEstimate", 0)
    
            important = (
                self.service.users()
                .messages()
                .list(userId="me", q="is:important is:unread", maxResults=1)
                .execute()
            ).get("resultSizeEstimate", 0)
    
            total = (
                self.service.users()
                .messages()
                .list(userId="me", q="in:inbox", maxResults=1)
                .execute()
            ).get("resultSizeEstimate", 0)
    
            return InboxStats(
                total_messages=total,
                unread_count=unread,
                starred_count=starred,
                important_count=important,
                updated_at=datetime.now(timezone.utc),
            )
        except HttpError as e:
            logger.error(f"Failed to get inbox stats: {e}")
            raise
  • Helper function to format InboxStats model into a markdown-formatted string for tool response.
    def _format_inbox_stats(stats) -> str:
        """Format inbox stats for display."""
        return f"""
    # 📊 Inbox Statistics
    
    - **Total Messages:** {stats.total_messages}
    - **Unread:** {stats.unread_count}
    - **Starred:** {stats.starred_count}
    - **Important (Unread):** {stats.important_count}
    
    _Updated: {stats.updated_at.strftime('%Y-%m-%d %H:%M:%S')}_
    """
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 what data is returned but doesn't describe how it behaves: e.g., whether it requires specific permissions, if it's a read-only operation (implied by 'get' but not explicit), potential rate limits, data freshness (real-time or cached), or error conditions. The description adds minimal context beyond the basic output metrics.

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 purpose ('Get current inbox statistics') and then lists the specific metrics. Every word earns its place with no redundancy or unnecessary details, making it easy to scan and understand 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 (0 parameters, no annotations, no output schema), the description is minimally adequate. It explains what the tool returns but lacks details on behavioral aspects like permissions, rate limits, or data sourcing. For a simple read operation, this might suffice, but the absence of annotations means the description should ideally cover more operational context to be fully complete.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the output semantics. This meets the baseline for tools with no parameters, as there's nothing to compensate for.

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: 'Get current inbox statistics' with specific metrics listed (total messages, unread count, starred count, important message count). It distinguishes itself from siblings like gmail_list_unread or gmail_get_priorities by focusing on aggregated statistics rather than listing or retrieving specific emails. However, it doesn't explicitly contrast with all siblings (e.g., gmail_category_summary might overlap in summarizing data).

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 prerequisites (e.g., authentication), timing considerations (e.g., real-time vs cached data), or compare it to siblings like gmail_daily_summary or gmail_get_categories that might provide related summary information. Usage is implied by the purpose but not explicitly defined.

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/murphy360/mcp_gmail'

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