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)

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