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')}_ """

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