Skip to main content
Glama
ntk148v

alertmanager-mcp-server

delete_silence

Delete an alert silence by providing its unique ID to remove the suppression rule.

Instructions

Delete a silence by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
silence_idYes

Implementation Reference

  • The actual handler function for the delete_silence tool. It is decorated with @mcp.tool and calls make_request with HTTP DELETE to /api/v2/silences/{silence_id}.
    @mcp.tool(description="Delete a silence by its ID")
    async def delete_silence(silence_id: str):
        """Delete a silence by its ID
    
        Parameters
        ----------
        silence_id : str
            The ID of the silence to be deleted.
    
        Returns
        -------
        dict:
            The response from the Alertmanager API.
        """
        return make_request(
            method="DELETE", route=url_join("/api/v2/silences/", silence_id)
        )
  • Registration of the tool via the @mcp.tool decorator on FastMCP instance 'mcp'.
    @mcp.tool(description="Delete a silence by its ID")
  • Helper function that safely joins base URL with path components, used by delete_silence to construct the API route.
    def url_join(base: str, path: str) -> str:
        """Join a base URL with a path, preserving the base URL's path component.
    
        Unlike urllib.parse.urljoin, this function preserves the path in the base URL
        when the path argument starts with '/'. This is useful for APIs hosted at
        subpaths (e.g., http://localhost:8080/alertmanager).
    
        Examples
        --------
        >>> url_join("http://localhost:8080/alertmanager", "/api/v2/alerts")
        'http://localhost:8080/alertmanager/api/v2/alerts'
    
        >>> url_join("http://localhost:8080/alertmanager/", "/api/v2/alerts")
        'http://localhost:8080/alertmanager/api/v2/alerts'
    
        >>> url_join("http://localhost:8080", "/api/v2/alerts")
        'http://localhost:8080/api/v2/alerts'
    
        Parameters
        ----------
        base : str
            The base URL which may include a path component
        path : str
            The path to append, which may or may not start with '/'
    
        Returns
        -------
        str
            The combined URL with both base path and appended path
        """
        # Remove trailing slash from base if present
        base = base.rstrip('/')
    
        # Remove leading slash from path if present
        path = path.lstrip('/')
    
        # Combine with a single slash
        return f"{base}/{path}"
  • The core HTTP request helper that delete_silence calls internally, sending a DELETE request 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)}
  • The tool's schema/interface is defined entirely through the function signature (silence_id: str) and the @mcp.tool decorator description.
    @mcp.tool(description="Delete a silence by its ID")
    async def delete_silence(silence_id: str):
        """Delete a silence by its ID
    
        Parameters
        ----------
        silence_id : str
            The ID of the silence to be deleted.
    
        Returns
        -------
        dict:
            The response from the Alertmanager API.
        """
        return make_request(
            method="DELETE", route=url_join("/api/v2/silences/", silence_id)
        )
Behavior2/5

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

No annotations are provided, so the description must disclose behavior. It only says 'Delete', implying mutation, but does not mention permanence, authorization needs, or side effects.

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 very short (one sentence), which is concise but may lack necessary detail. It is not overly verbose, but could be improved with minimal extra context.

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?

For a simple delete tool with one parameter, the description is moderately complete. However, it lacks information about idempotency, error cases, or consequences, which would help an agent use it correctly.

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

Parameters2/5

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

Schema description coverage is 0%, so the description should add meaning to parameters. It mentions 'by its ID' but does not specify the parameter name or format beyond the schema.

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 action 'Delete' and the resource 'a silence by its ID'. It is specific and distinguishes from sibling tools like get_silence or post_silence.

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 on when to use this tool versus alternatives like post_silence or get_silence. It does not mention prerequisites or context for deletion.

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