get_alert_details
Retrieve comprehensive information about a specific Kubernetes alert from the Karma Alert dashboard to analyze details and monitor status.
Instructions
Get detailed information about a specific alert
Args: alert_name: Name of the alert to get details for
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alert_name | Yes |
Implementation Reference
- src/karma_mcp/server.py:470-528 (handler)The get_alert_details tool handler function implementation, which fetches all alerts from Karma API and filters for the specified alert_name, then formats the details of matching alert instances.
async def get_alert_details(alert_name: str) -> str: """Get detailed information about a specific alert Args: alert_name: Name of the alert to get details for """ data, error = await fetch_karma_alerts() if error: return error # Find matching alerts matching_alerts = [] grids = data.get("grids", []) for grid in grids: for group in grid.get("alertGroups", []): alertname = extract_label_value(group.get("labels", []), "alertname") if alertname.lower() == alert_name.lower(): for alert in group.get("alerts", []): matching_alerts.append({"alert": alert, "group": group}) if not matching_alerts: return f"No alert found with name: {alert_name}" # Format alert details details = f"🔍 Found {len(matching_alerts)} instance(s) of {alert_name}:\n\n" for i, item in enumerate(matching_alerts, 1): alert = item["alert"] group = item["group"] metadata = extract_alert_metadata(group, alert) annotations = extract_annotations(alert) details += f"📋 Instance {i}:\n" details += f" State: {metadata['state']}\n" details += f" Severity: {metadata['severity']}\n" details += f" Namespace: {metadata['namespace']}\n" details += f" Cluster: {metadata['cluster']}\n" # Add instance if available instance = extract_label_value(alert.get("labels", []), "instance") if instance != "unknown": details += f" Instance: {instance}\n" # Add annotations if "description" in annotations: description = annotations["description"] if len(description) > 200: description = description[:200] + "..." details += f" Description: {description}\n" if "summary" in annotations: details += f" Summary: {annotations['summary']}\n" details += "\n" return details