Skip to main content
Glama

gmail_get_categories

Retrieve configured email categories and their matching rules to understand how emails are automatically organized by sender, subject, and labels.

Instructions

List the configured email categories and their matching rules. Shows how emails are automatically categorized based on sender, subject, and labels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler that retrieves the categories configuration using get_categories_config() and formats it using _format_categories_config for the tool response.
    elif name == "gmail_get_categories":
        categories = get_categories_config()
        return [TextContent(type="text", text=_format_categories_config(categories))]
  • Tool registration in GMAIL_TOOLS list, including name, description, and input schema (empty object).
        name="gmail_get_categories",
        description="List the configured email categories and their matching rules. Shows how emails are automatically categorized based on sender, subject, and labels.",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": []
        },
    ),
  • Input schema definition for the tool: object with no properties.
        name="gmail_get_categories",
        description="List the configured email categories and their matching rules. Shows how emails are automatically categorized based on sender, subject, and labels.",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": []
        },
    ),
  • Helper function that formats the categories configuration into a human-readable text string for the tool output.
    def _format_categories_config(categories) -> str:
        """Format categories configuration for display.
        
        Args:
            categories: Categories configuration object.
            
        Returns:
            str: Formatted string representation.
        """
        lines = ["Configured Email Categories\n"]
    
        for cat in categories.get_all_categories():
            priority_label = {"critical": "CRITICAL", "high": "HIGH", "normal": "NORMAL", "low": "LOW"}.get(
                cat.priority, "NORMAL"
            )
            lines.append(f"[{priority_label}] {cat.name}")
            lines.append(f"Key: {cat.key} | Priority: {cat.priority}")
            lines.append(f"Description: {cat.description}")
    
            if cat.matcher.senders:
                lines.append(f"Sender patterns: {', '.join(cat.matcher.senders)}")
            if cat.matcher.subjects:
                lines.append(f"Subject patterns: {', '.join(cat.matcher.subjects)}")
            if cat.matcher.labels:
                lines.append(f"Labels: {', '.join(cat.matcher.labels)}")
            lines.append("")
    
        return "\n".join(lines)
  • Function that loads the CategoriesConfig from the YAML file path in settings.
    def get_categories_config(settings: Settings | None = None) -> CategoriesConfig:
        """Get categories configuration."""
        if settings is None:
            settings = get_settings()
        return CategoriesConfig(settings.categories_config)
Behavior2/5

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

With no annotations provided, the description carries full burden. It describes what the tool does (list categories and rules) but lacks behavioral details like whether this requires authentication, if it's a read-only operation, rate limits, or what format the output takes. It doesn't contradict annotations, but provides minimal behavioral context.

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 concise sentences that efficiently convey the tool's purpose. The first sentence states the core function, and the second elaborates on what it shows. Every word earns its place with no redundancy or fluff.

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?

For a tool with 0 parameters and no output schema, the description adequately explains what it does. However, without annotations or output schema, it lacks details about return format, authentication needs, or error handling. It's complete enough for basic understanding but misses advanced contextual information.

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 tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description doesn't discuss parameters, which is appropriate. Baseline for 0 parameters is 4, as it doesn't need to compensate for any gaps.

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's purpose with specific verbs ('List', 'Shows') and resources ('configured email categories and their matching rules', 'how emails are automatically categorized'). It distinguishes from siblings like gmail_list_labels (which lists labels) and gmail_category_summary (which might summarize categories differently).

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 implies usage for understanding email categorization rules, but doesn't explicitly state when to use this tool versus alternatives like gmail_category_summary or gmail_get_priorities. No exclusions or prerequisites are mentioned, leaving usage context somewhat vague.

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