Skip to main content
Glama

prom_alert_rules

View and monitor all Prometheus alert rules with their current status to manage infrastructure alerts effectively.

Instructions

List all Prometheus alert rules and their current state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the `alertRules` function, which fetches and formats Prometheus alert rules.
    export async function alertRules(): Promise<string> {
      const url = `${config.prometheusUrl}/api/v1/rules`;
      const res = await fetch(url);
      if (!res.ok) throw new Error(`Failed to fetch rules: ${res.status}`);
    
      const data = (await res.json()) as { data: { groups: Array<{ name: string; interval: string; rules: Array<{ type: string; name: string; state: string; labels: Record<string, string>; alerts: unknown[] }> }> } };
      const groups = data.data?.groups || [];
    
      const lines: string[] = ["Alert rules:"];
    
      for (const group of groups) {
        lines.push(`\nGroup: ${group.name} (interval: ${group.interval})`);
        const rules = (group.rules || []).filter((r: { type: string }) => r.type === "alerting");
    
        if (rules.length === 0) continue;
    
        const headers = ["RULE", "STATE", "SEVERITY", "ACTIVE"];
        const rows = rules.map((r: { name: string; state: string; labels: Record<string, string>; alerts: unknown[] }) => [
          r.name,
          r.state,
          r.labels?.severity || "N/A",
          String(r.alerts?.length || 0),
        ]);
        lines.push(formatTable(headers, rows));
      }
    
      return lines.join("\n");
    }
  • The registration definition for the "prom_alert_rules" tool.
      name: "prom_alert_rules",
      description: "List all Prometheus alert rules and their current state",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • The switch case in handlePrometheusTool that calls the alertRules implementation.
    case "prom_alert_rules": return alertRules();
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 the tool lists rules and states, implying a read-only operation, but does not disclose behavioral traits such as required permissions, rate limits, pagination, or error handling. This is a significant gap for a tool with no annotation coverage.

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 front-loads the purpose ('List all Prometheus alert rules and their current state') with zero wasted words. It is appropriately sized for a simple tool.

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's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. However, it lacks details on output format (e.g., structure of rules and states) and behavioral context, which would be helpful for an AI agent to use it correctly without annotations.

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 does not add parameter details, which is appropriate, but it could marginally enhance semantics by clarifying scope (e.g., all namespaces). Baseline is 4 for zero parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('List all') and resource ('Prometheus alert rules and their current state'), distinguishing it from sibling tools like prom_active_alerts (which likely shows only active alerts) and prom_instant_query/prom_range_query (which are for querying metrics). It precisely defines scope without redundancy.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

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

The description implies usage for retrieving alert rules and states, providing clear context. However, it does not explicitly state when to use this versus alternatives like prom_active_alerts or general query tools, nor does it mention prerequisites or exclusions, leaving some guidance gaps.

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

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