Skip to main content
Glama
driosalido
by driosalido

list_suppressed_alerts

View suppressed alerts in Kubernetes monitoring to identify silenced notifications and manage alert configurations effectively.

Instructions

List only suppressed alerts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `list_suppressed_alerts` function is the handler that fetches alerts from the Karma API, filters them to find suppressed instances, groups them by alert name, and formats the result.
    async def list_suppressed_alerts() -> str:
        """List only suppressed alerts"""
        try:
            async with httpx.AsyncClient() as client:
                response = await client.post(
                    f"{KARMA_URL}/alerts.json",
                    headers={"Content-Type": "application/json"},
                    json={},
                )
    
                if response.status_code == 200:
                    data = response.json()
    
                    suppressed_alerts = []
                    grids = data.get("grids", [])
    
                    for grid in grids:
                        for group in grid.get("alertGroups", []):
                            # Get group labels (contains alertname)
                            group_labels_dict = {}
                            for label in group.get("labels", []):
                                group_labels_dict[label.get("name", "")] = label.get(
                                    "value", ""
                                )
    
                            alertname = group_labels_dict.get("alertname", "unknown")
    
                            for alert in group.get("alerts", []):
                                alert_state = alert.get("state", "unknown")
    
                                # Only include suppressed alerts
                                if alert_state.lower() == "suppressed":
                                    # Convert alert labels to dict
                                    alert_labels_dict = {}
                                    for label in alert.get("labels", []):
                                        alert_labels_dict[label.get("name", "")] = (
                                            label.get("value", "")
                                        )
    
                                    suppressed_alerts.append(
                                        {
                                            "name": alertname,
                                            "state": alert_state,
                                            "severity": resolve_severity(
                                                group_labels_dict, alert_labels_dict
                                            ),
                                            "namespace": alert_labels_dict.get(
                                                "namespace", "N/A"
                                            ),
                                            "instance": alert_labels_dict.get(
                                                "instance", "N/A"
                                            ),
                                            "starts_at": alert.get("startsAt", "N/A"),
                                        }
                                    )
    
                    if not suppressed_alerts:
                        return "No suppressed alerts found."
    
                    # Format output
                    result = "Suppressed Alerts\n"
                    result += "=" * 50 + "\n\n"
    
                    # Group by alert name
                    alert_groups = {}
                    for alert in suppressed_alerts:
                        name = alert["name"]
                        if name not in alert_groups:
                            alert_groups[name] = []
                        alert_groups[name].append(alert)
    
                    for alertname, alerts in sorted(alert_groups.items()):
                        result += f"🔕 {alertname} ({len(alerts)} instance{'s' if len(alerts) > 1 else ''})\n"
                        result += f"   Severity: {alerts[0]['severity']}\n"
    
                        # Show details for each instance
                        for alert in alerts[:5]:  # Limit to 5 instances to avoid clutter
                            result += f"   • {alert['instance']} ({alert['namespace']})\n"
    
                        if len(alerts) > 5:
                            result += f"   • ... and {len(alerts) - 5} more\n"
    
                        result += "\n"
    
                    result += f"Total Suppressed Alerts: {len(suppressed_alerts)}"
                    return result
                else:
                    return f"Error fetching alerts: code {response.status_code}"
    
        except Exception as e:
            return f"Error connecting to Karma: {str(e)}"
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it's a list operation, implying read-only, but doesn't disclose behavioral traits like pagination, rate limits, authentication needs, or what 'suppressed' entails (e.g., silenced vs. resolved). This leaves gaps for an agent.

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 with zero waste: 'List only suppressed alerts' is front-loaded and directly states the action and scope. Every word earns its place, making it highly concise.

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 0 parameters, an output schema exists, and no annotations, the description is minimal but adequate. It specifies the resource type, but for a tool in a set with many alert-related siblings, more context on suppression meaning or use cases would enhance completeness.

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 doesn't add param info, which is fine, but it implies filtering by suppression status, aligning with the tool's purpose. Baseline is 4 for zero params.

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: 'List only suppressed alerts' specifies the verb (list) and resource (suppressed alerts). It distinguishes from siblings like 'list_active_alerts' and 'list_alerts' by focusing on suppressed ones, though it doesn't explicitly contrast them.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'list_alerts' and 'list_active_alerts', the description doesn't explain if this is for filtered views, troubleshooting, or specific workflows, leaving usage unclear.

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