list_clusters
Retrieve all available Kubernetes clusters from the Karma Alert dashboard to monitor and analyze alerts across your infrastructure.
Instructions
List all available Kubernetes clusters in Karma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/karma_mcp/server.py:387-414 (handler)The 'list_clusters' tool handler implementation. It fetches alert data, extracts cluster information, and returns a formatted string.
async def list_clusters() -> str: """List all available Kubernetes clusters in Karma""" data, error = await fetch_karma_alerts() if error: return error clusters, cluster_alert_counts = extract_cluster_info(data) # Format output result = "🏢 Available Kubernetes Clusters\n" result += "=" * 50 + "\n\n" for cluster_name, info in sorted(clusters.items()): alert_count = cluster_alert_counts.get(cluster_name, 0) status_icon = "✅" if "healthy" in info["status"] else "❌" result += f"📋 {cluster_name}\n" result += f" Instance: {info['instance_name']}\n" result += f" Status: {status_icon} {info['status']}\n" result += f" Alertmanager: {info['version']}\n" result += f" Active Alerts: {alert_count}\n" result += f" URI: {info['uri']}\n\n" result += "📊 Summary:\n" result += f" Total Clusters: {len(clusters)}\n" result += f" Total Alert Instances: {sum(cluster_alert_counts.values())}" return result