Skip to main content
Glama

list_cloudwatch_alarms

Retrieve and filter AWS CloudWatch alarms by state to monitor system health and performance metrics.

Instructions

Lists CloudWatch alarms, optionally filtering by state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateNoFilter alarms by state.

Implementation Reference

  • The handler function for the 'list_cloudwatch_alarms' tool. It optionally filters CloudWatch alarms by state using DescribeAlarmsCommand on the cloudWatchClient, maps relevant fields (AlarmName, StateValue, StateReason, MetricName, Namespace), and returns them as JSON.
    if (name === "list_cloudwatch_alarms") {
        const state = (args as any)?.state;
        const commandInput: any = {};
        if (state) commandInput.StateValue = state;
    
        const command = new DescribeAlarmsCommand(commandInput);
        const response = await cloudWatchClient.send(command);
    
        const alarms = response.MetricAlarms?.map(a => ({
            AlarmName: a.AlarmName,
            StateValue: a.StateValue,
            StateReason: a.StateReason,
            MetricName: a.MetricName,
            Namespace: a.Namespace
        })) || [];
    
        return {
            content: [{ type: "text", text: JSON.stringify(alarms, null, 2) }]
        };
    }
  • src/index.ts:161-173 (registration)
    Registration of the 'list_cloudwatch_alarms' tool in the ListTools response, including name, description, and input schema definition.
        name: "list_cloudwatch_alarms",
        description: "Lists CloudWatch alarms, optionally filtering by state.",
        inputSchema: {
            type: "object",
            properties: {
                state: {
                    type: "string",
                    enum: ["OK", "ALARM", "INSUFFICIENT_DATA"],
                    description: "Filter alarms by state."
                }
            }
        }
    },
  • Input schema for the 'list_cloudwatch_alarms' tool, defining optional 'state' parameter with valid enum values.
        name: "list_cloudwatch_alarms",
        description: "Lists CloudWatch alarms, optionally filtering by state.",
        inputSchema: {
            type: "object",
            properties: {
                state: {
                    type: "string",
                    enum: ["OK", "ALARM", "INSUFFICIENT_DATA"],
                    description: "Filter alarms by state."
                }
            }
        }
    },
  • Initialization of the CloudWatchClient used by the list_cloudwatch_alarms handler.
    const cloudWatchClient = new CloudWatchClient({});
  • Import of CloudWatchClient and DescribeAlarmsCommand required for the tool implementation.
    import { CloudWatchClient, DescribeAlarmsCommand } from "@aws-sdk/client-cloudwatch";
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions optional filtering by state but fails to describe critical traits: whether this is a read-only operation (implied by 'Lists' but not explicit), potential rate limits, pagination behavior, required authentication, or output format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise and front-loaded, consisting of a single sentence that directly states the tool's purpose and key feature. There is no wasted language or redundancy, making it efficient and easy to parse. This earns a perfect score for conciseness and structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a list operation with filtering) and lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like safety (read-only vs. destructive), authentication needs, rate limits, or return values. While it mentions filtering, it fails to provide a holistic view needed for effective use, resulting in a low score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal value beyond the input schema, which has 100% coverage for its single parameter ('state'). It mentions 'optionally filtering by state,' aligning with the schema's description, but doesn't provide additional context like default behavior if omitted or interaction with other filters. With high schema coverage, the baseline is 3, as the description doesn't significantly enhance parameter understanding.

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 with a specific verb ('Lists') and resource ('CloudWatch alarms'), making it immediately understandable. It distinguishes itself from siblings by focusing on alarms rather than other AWS resources like instances, buckets, or logs. However, it doesn't explicitly differentiate from potential similar tools (e.g., 'get_metric_statistics' for metrics vs. alarms), keeping it at a 4 rather than a 5.

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?

The description provides minimal guidance with 'optionally filtering by state,' but offers no explicit context on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., AWS permissions), compare to siblings like 'search_cloudwatch_logs' for related data, or specify scenarios (e.g., monitoring vs. troubleshooting). This lack of detailed when-to-use guidance results in a score of 2.

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/bhaveshopss/MCP-server'

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