Skip to main content
Glama
comqx

Prometheus Alertmanager MCP Server

by comqx

create-silence

Suppress specific Prometheus Alertmanager alerts temporarily by creating silences with matchers, duration, and explanatory comments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
matchersYesList of matchers for alerts
startsAtNoSilence start time (ISO8601 format, default is current time)
endsAtYesSilence end time (ISO8601 format)
createdByYesUsername who created the silence
commentYesReason or explanation for the silence

Implementation Reference

  • Handler function that implements the logic to create a silence by preparing matcher data and POSTing to Alertmanager's /api/v2/silences endpoint.
    async ({ matchers, startsAt, endsAt, createdBy, comment }) => {
      try {
        // Prepare silence data
        const now = new Date().toISOString();
        const silenceData = {
          matchers: matchers.map(m => ({
            name: m.name,
            value: m.value,
            isRegex: m.isRegex || false,
          })),
          startsAt: startsAt || now,
          endsAt,
          createdBy,
          comment,
        };
        
        // Create the silence
        const response = await fetchFromAlertmanager('silences', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify(silenceData),
        });
        
        return {
          content: [{
            type: "text",
            text: `Successfully created silence with ID: ${response.silenceID}`
          }]
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [{
            type: "text",
            text: `Error creating silence: ${errorMessage}`
          }],
          isError: true
        };
      }
    }
  • Zod input schema defining parameters for creating a silence: matchers, optional startsAt, endsAt, createdBy, and comment.
    {
      matchers: z.array(z.object({
        name: z.string().describe("Matcher name (e.g. alertname)"),
        value: z.string().describe("Matcher value (e.g. HighCPULoad)"),
        isRegex: z.boolean().optional().describe("Use regex matching"),
      })).describe("List of matchers for alerts"),
      startsAt: z.string().optional().describe("Silence start time (ISO8601 format, default is current time)"),
      endsAt: z.string().describe("Silence end time (ISO8601 format)"),
      createdBy: z.string().describe("Username who created the silence"),
      comment: z.string().describe("Reason or explanation for the silence"),
    },
  • src/index.ts:213-268 (registration)
    Registration of the create-silence tool on the MCP server using server.tool() with name, input schema, and handler function.
    server.tool(
      "create-silence",
      {
        matchers: z.array(z.object({
          name: z.string().describe("Matcher name (e.g. alertname)"),
          value: z.string().describe("Matcher value (e.g. HighCPULoad)"),
          isRegex: z.boolean().optional().describe("Use regex matching"),
        })).describe("List of matchers for alerts"),
        startsAt: z.string().optional().describe("Silence start time (ISO8601 format, default is current time)"),
        endsAt: z.string().describe("Silence end time (ISO8601 format)"),
        createdBy: z.string().describe("Username who created the silence"),
        comment: z.string().describe("Reason or explanation for the silence"),
      },
      async ({ matchers, startsAt, endsAt, createdBy, comment }) => {
        try {
          // Prepare silence data
          const now = new Date().toISOString();
          const silenceData = {
            matchers: matchers.map(m => ({
              name: m.name,
              value: m.value,
              isRegex: m.isRegex || false,
            })),
            startsAt: startsAt || now,
            endsAt,
            createdBy,
            comment,
          };
          
          // Create the silence
          const response = await fetchFromAlertmanager('silences', {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
            },
            body: JSON.stringify(silenceData),
          });
          
          return {
            content: [{
              type: "text",
              text: `Successfully created silence with ID: ${response.silenceID}`
            }]
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return {
            content: [{
              type: "text",
              text: `Error creating silence: ${errorMessage}`
            }],
            isError: true
          };
        }
      }
    );
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/comqx/alertmanager-mcp'

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