Skip to main content
Glama

prom_active_alerts

Monitor and list currently firing Prometheus alerts to identify active infrastructure issues requiring immediate attention.

Instructions

List all currently firing Prometheus alerts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler logic for `prom_active_alerts`, which fetches alerts from the Prometheus API and formats them into a table.
    export async function activeAlerts(): Promise<string> {
      const url = `${config.prometheusUrl}/api/v1/alerts`;
      const res = await fetch(url);
      if (!res.ok) throw new Error(`Failed to fetch alerts: ${res.status}`);
    
      const data = (await res.json()) as { data: { alerts: Array<{ state: string; labels: Record<string, string>; annotations: Record<string, string> }> } };
      const alerts = data.data?.alerts || [];
    
      const firing = alerts.filter((a: { state: string }) => a.state === "firing");
      if (firing.length === 0) return "No active alerts firing.";
    
      const headers = ["ALERT", "STATE", "SEVERITY", "SUMMARY"];
      const rows = firing.map((a: { labels: Record<string, string>; annotations: Record<string, string>; state: string }) => [
        a.labels.alertname || "unknown",
        a.state,
        a.labels.severity || "N/A",
        (a.annotations?.summary || a.annotations?.description || "").substring(0, 60),
      ]);
    
      return `Active alerts (${firing.length} firing):\n\n${formatTable(headers, rows)}`;
    }
  • Registration of the `prom_active_alerts` tool in the Prometheus tools list.
      name: "prom_active_alerts",
      description: "List all currently firing Prometheus alerts",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • Routing logic inside `handlePrometheusTool` that dispatches the `prom_active_alerts` tool call to the `activeAlerts` function.
    case "prom_active_alerts": return activeAlerts();

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/batu-sonmez/infraclaude'

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