Skip to main content
Glama
ntk148v

alertmanager-mcp-server

get_silences

Retrieve and manage active alert silences from Alertmanager to monitor and control notification suppression.

Instructions

Get list of all silences

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
countNo
offsetNo

Implementation Reference

  • The main handler function for the 'get_silences' MCP tool. It is decorated with @mcp.tool, handles input parameters for filter, count, and offset, validates pagination, fetches silences from the Alertmanager /api/v2/silences endpoint, and applies pagination using helper functions.
    @mcp.tool(description="Get list of all silences")
    async def get_silences(filter: Optional[str] = None,
                           count: int = DEFAULT_SILENCE_PAGE,
                           offset: int = 0):
        """Get list of all silences
    
        Parameters
        ----------
        filter
            Filtering query (e.g. alertname=~'.*CPU.*')"),
        count
            Number of silences to return per page (default: 10, max: 50).
        offset
            Number of silences to skip before returning results (default: 0).
            To paginate through all results, make multiple calls with increasing
            offset values (e.g., offset=0, offset=10, offset=20, etc.).
    
        Returns
        -------
        dict
            A dictionary containing:
            - data: List of Silence objects for the current page
            - pagination: Metadata about pagination (total, offset, count, has_more)
              Use the 'has_more' flag to determine if additional pages are available.
        """
        # Validate pagination parameters
        count, offset, error = validate_pagination_params(
            count, offset, MAX_SILENCE_PAGE)
        if error:
            return {"error": error}
    
        params = None
        if filter:
            params = {"filter": filter}
    
        # Get all silences from the API
        all_silences = make_request(
            method="GET", route="/api/v2/silences", params=params)
    
        # Apply pagination and return results
        return paginate_results(all_silences, count, offset)

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