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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_gmail/server.py:803-805 (handler)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))]
- src/mcp_gmail/server.py:334-341 (registration)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": [] }, ),
- src/mcp_gmail/server.py:334-341 (schema)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": [] }, ),
- src/mcp_gmail/server.py:1399-1426 (helper)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)
- src/mcp_gmail/config.py:148-153 (helper)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)