Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

list_gmail_labels

Retrieve and display all Gmail labels, including their IDs, names, and types, for a specified user email address using the Google Workspace MCP Server.

Instructions

Lists all labels in the user's Gmail account.

Args:
    user_google_email (str): The user's Google email address. Required.

Returns:
    str: A formatted list of all labels with their IDs, names, and types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYes
user_google_emailYes

Implementation Reference

  • The main handler function for the 'list_gmail_labels' tool, including decorators for registration (@server.tool()), error handling, and authentication requirements. It lists all Gmail labels, categorizing them into system and user labels, and returns a formatted string.
    @handle_http_errors("list_gmail_labels", is_read_only=True, service_type="gmail")
    @require_google_service("gmail", "gmail_read")
    async def list_gmail_labels(service, user_google_email: str) -> str:
        """
        Lists all labels in the user's Gmail account.
    
        Args:
            user_google_email (str): The user's Google email address. Required.
    
        Returns:
            str: A formatted list of all labels with their IDs, names, and types.
        """
        logger.info(f"[list_gmail_labels] Invoked. Email: '{user_google_email}'")
    
        response = await asyncio.to_thread(
            service.users().labels().list(userId="me").execute
        )
        labels = response.get("labels", [])
    
        if not labels:
            return "No labels found."
    
        lines = [f"Found {len(labels)} labels:", ""]
    
        system_labels = []
        user_labels = []
    
        for label in labels:
            if label.get("type") == "system":
                system_labels.append(label)
            else:
                user_labels.append(label)
    
        if system_labels:
            lines.append("📂 SYSTEM LABELS:")
            for label in system_labels:
                lines.append(f"  • {label['name']} (ID: {label['id']})")
            lines.append("")
    
        if user_labels:
            lines.append("🏷️  USER LABELS:")
            for label in user_labels:
                lines.append(f"  • {label['name']} (ID: {label['id']})")
    
        return "\n".join(lines)
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 mentions the return format ('A formatted list of all labels with their IDs, names, and types'), which is helpful, but fails to address critical aspects like whether this is a read-only operation, potential rate limits, authentication requirements, or error handling. For a tool with no annotation coverage, this leaves significant gaps.

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 well-structured and front-loaded, with the core purpose stated first, followed by clear sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and easy to parse.

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 moderate complexity (2 parameters, no output schema, no annotations), the description is partially complete. It explains the return value but lacks details on parameters, behavioral traits, and usage context. Without annotations or output schema, it should do more to compensate, resulting in an average score.

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?

Schema description coverage is 0%, so the description must compensate. It documents one parameter ('user_google_email') with its type and requirement, but omits the 'service' parameter entirely. This leaves half of the parameters undocumented, failing to provide adequate semantic context beyond the bare schema.

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: 'Lists all labels in the user's Gmail account.' It specifies the verb ('Lists'), resource ('labels'), and scope ('user's Gmail account'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'manage_gmail_label' or 'modify_gmail_message_labels', which prevents a perfect score.

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 sibling tools such as 'search_gmail_messages' or 'get_gmail_message_content', nor does it specify prerequisites like authentication or context for listing labels. This lack of usage context leaves the agent without clear direction.

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/taylorwilsdon/google_workspace_mcp'

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