Skip to main content
Glama
driosalido
by driosalido

get_alerts_summary

Summarize Kubernetes alerts by severity and state to monitor and analyze alert status from the Karma dashboard.

Instructions

Get a summary of alerts grouped by severity and state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler implementation for get_alerts_summary tool, which fetches Karma data and uses format_alert_summary utility to return the alert statistics.
    async def get_alerts_summary() -> str:
        """Get a summary of alerts grouped by severity and state"""
        data, error = await fetch_karma_alerts()
        if error:
            return error
    
        # Use the centralized summary function
        summary = format_alert_summary(data, include_clusters=True)
    
        # Add top alert types section
        alert_type_counts = {}
        grids = data.get("grids", [])
        for grid in grids:
            for group in grid.get("alertGroups", []):
                alertname = extract_label_value(
                    group.get("labels", []), "alertname", "Unknown"
                )
                alert_count = len(group.get("alerts", []))
                alert_type_counts[alertname] = (
                    alert_type_counts.get(alertname, 0) + alert_count
                )
    
        # Add top alert types to summary
        if alert_type_counts:
            summary += "\nšŸ” Top Alert Types:\n"
            top_alerts = sorted(
                alert_type_counts.items(), key=lambda x: x[1], reverse=True
            )[:10]
            for alertname, count in top_alerts:
                summary += f"  • {alertname}: {count}\n"
    
        return summary
  • Helper function that formats alert data into a readable summary, used by the get_alerts_summary tool.
    def format_alert_summary(alerts_data, include_clusters=False):
        """Format alert data into a readable summary"""
        total_alerts = 0
        severity_counts = {"critical": 0, "warning": 0, "info": 0, "none": 0}
        state_counts = {"active": 0, "suppressed": 0}
        cluster_counts = {}
    
        grids = alerts_data.get("grids", [])
    
        for grid in grids:
            for group in grid.get("alertGroups", []):
                alerts = group.get("alerts", [])
                total_alerts += len(alerts)
    
                for alert in alerts:
                    metadata = extract_alert_metadata(group, alert)
    
                    # Count by severity
                    severity = metadata["severity"]
                    if severity in severity_counts:
                        severity_counts[severity] += 1
    
                    # Count by state
                    state = metadata["state"]
                    if state in state_counts:
                        state_counts[state] += 1
    
                    # Count by cluster if needed
                    if include_clusters:
                        cluster = metadata["cluster"]
                        cluster_counts[cluster] = cluster_counts.get(cluster, 0) + 1
    
        # Format summary matching the expected test format
        summary = f"Total Alerts: {total_alerts}\n"
    
        # Severity breakdown
        summary += "\nBy Severity:\n"
        for severity, count in severity_counts.items():
            if count > 0:
                summary += f"  {severity.capitalize()}: {count}\n"
    
        summary += "\nBy State:\n"
        for state, count in state_counts.items():
            if count > 0:
                summary += f"  {state.capitalize()}: {count}\n"
    
        if include_clusters and cluster_counts:
            summary += "\nBy Cluster:\n"
            sorted_clusters = sorted(
                cluster_counts.items(), key=lambda x: x[1], reverse=True
            )
            for cluster, count in sorted_clusters:
                summary += f"  {cluster}: {count}\n"
    
        return summary
  • Registration of the get_alerts_summary tool in the MCP server's tool list.
        "name": "get_alerts_summary",
        "description": "Get alert statistics",
        "inputSchema": {"type": "object", "properties": {}, "required": []},
    },
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 tool's purpose but lacks details on permissions, rate limits, data freshness, or response format. For a read operation with no annotations, this leaves significant gaps in understanding how the tool behaves beyond its basic function.

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 a single, efficient sentence that directly states the tool's function without any fluff. It is front-loaded with the core action and resource, making it easy to parse quickly. Every word contributes to understanding the purpose, earning its place.

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 has 0 parameters, 100% schema coverage, and an output schema exists, the description's job is simplified. It covers the basic purpose adequately but lacks behavioral context (e.g., permissions, data scope) that would be helpful for an agent. With no annotations, it doesn't fully compensate for missing operational details, making it minimally viable but incomplete.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately adds no parameter details, focusing solely on the tool's purpose. This meets the baseline for tools with no parameters, as it doesn't need to compensate for any schema gaps.

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 action ('Get a summary') and the resource ('alerts'), specifying grouping by 'severity and state'. It distinguishes from siblings like 'list_alerts' or 'get_alert_details' by focusing on aggregated data rather than listing or detailing individual alerts. However, it doesn't explicitly contrast with all siblings (e.g., 'get_alerts_by_state'), keeping it from 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 Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for obtaining aggregated alert statistics rather than raw lists or details, but it doesn't explicitly state when to use this tool versus alternatives like 'list_alerts' or 'get_alerts_by_state'. No guidance on prerequisites, exclusions, or specific contexts is provided, leaving usage somewhat inferred rather than clearly defined.

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/driosalido/mcp-karma'

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