Skip to main content
Glama
ntk148v

alertmanager-mcp-server

post_silence

Create a new silence or modify an existing one in Alertmanager to suppress notifications for specified alerts.

Instructions

Post a new silence or update an existing one

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
silenceYes

Implementation Reference

  • The handler function for the 'post_silence' tool. Decorated with @mcp.tool, it takes a silence dict and makes a POST request to the Alertmanager API at /api/v2/silences.
    @mcp.tool(description="Post a new silence or update an existing one")
    async def post_silence(silence: Dict[str, Any]):
        """Post a new silence or update an existing one
    
        Parameters
        ----------
        silence : dict
            A dict representing the silence to be posted. This dict should
            contain the following keys:
                - matchers: list of matchers to match alerts to silence
                - startsAt: start time of the silence
                - endsAt: end time of the silence
                - createdBy: name of the user creating the silence
                - comment: comment for the silence
    
        Returns
        -------
        dict:
            Create / update silence response from Alertmanager API.
        """
        return make_request(method="POST", route="/api/v2/silences", json=silence)
  • The tool is registered via the @mcp.tool decorator on line 377, which is a FastMCP instance created on line 60.
    @mcp.tool(description="Post a new silence or update an existing one")
  • The input schema is defined by the parameter type hint Dict[str, Any] and documented in the docstring (matchers, startsAt, endsAt, createdBy, comment). No formal Pydantic schema class is defined; the dict is passed through directly.
    async def post_silence(silence: Dict[str, Any]):
  • The make_request helper function is called by post_silence to actually execute the HTTP POST to the Alertmanager API.
    def make_request(method="GET", route="/", **kwargs):
        """Make HTTP request and return a requests.Response object.
    
        Parameters
        ----------
        method : str
            HTTP method to use for the request.
        route : str
            (Default value = "/")
            This is the url we are making our request to.
        **kwargs : dict
            Arbitrary keyword arguments.
    
    
        Returns
        -------
        dict:
            The response from the Alertmanager API. This is a dictionary
            containing the response data.
        """
        try:
            route = url_join(config.url, route)
            auth = (
                requests.auth.HTTPBasicAuth(config.username, config.password)
                if config.username and config.password
                else None
            )
    
            # Add X-Scope-OrgId header for multi-tenant setups
            # Priority: 1) Request header from caller (via ContextVar), 2) Static config tenant
            headers = kwargs.get("headers", {})
    
            tenant_id = _current_scope_org_id.get() or config.tenant_id
    
            if tenant_id:
                headers["X-Scope-OrgId"] = tenant_id
            if headers:
                kwargs["headers"] = headers
    
            response = requests.request(
                method=method.upper(), url=route, auth=auth, timeout=60, **kwargs
            )
            response.raise_for_status()
            result = response.json()
    
            # Ensure we always return something (empty list is valid but might cause issues)
            if result is None:
                return {"message": "No data returned"}
            return result
        except requests.exceptions.RequestException as e:
            return {"error": str(e)}
Behavior2/5

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

No annotations exist, and the description does not disclose behavioral traits such as required permissions, side effects, or what happens when updating a non-existent silence. The verb 'post' implies creation, but the dual purpose is noted without further clarification.

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

Conciseness3/5

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

The description is brief at one sentence, front-loading the purpose. However, it sacrifices necessary detail for conciseness, resulting in under-specification.

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 lack of annotations, output schema, and parameter documentation, the description is incomplete for a tool with a complex object parameter. The agent would need to infer or guess the expected input structure.

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?

The description provides zero explanation of the 'silence' object parameter. With 0% schema coverage and additionalProperties: true, the agent has no guidance on valid or required fields, making it difficult to use correctly.

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?

Description clearly states the tool can post a new silence or update an existing one, distinguishing two operations on the same resource. However, it does not explain what a 'silence' represents, leaving some ambiguity.

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?

No guidance is provided on when to use this tool versus alternatives like delete_silence or get_silence. There is no mention of prerequisites, context, or examples.

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

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