Skip to main content
Glama
ntk148v

alertmanager-mcp-server

get_silences

Retrieve a list of all silences from Alertmanager-MCP Server based on optional filters, enabling efficient monitoring and incident management.

Instructions

Get list of all silences

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo

Implementation Reference

  • The primary handler function for the 'get_silences' tool. It is registered using the @mcp.tool decorator and implements the tool logic by calling the make_request helper to fetch silences from the Alertmanager API, optionally filtered by the provided parameter.
    @mcp.tool(description="Get list of all silences") async def get_silences(filter: Optional[str] = None): """Get list of all silences Parameters ---------- filter Filtering query (e.g. alertname=~'.*CPU.*')"), Returns ------- list: Return a list of Silence objects from Alertmanager instance. """ params = None if filter: params = {"filter": filter} return make_request(method="GET", route="/api/v2/silences", params=params)
  • Shared helper function used by the get_silences tool (and others) to perform HTTP requests to the Alertmanager server, handling authentication and error raising.
    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. """ route = urljoin(config.url, route) auth = ( requests.auth.HTTPBasicAuth(config.username, config.password) if config.username and config.password else None ) response = requests.request( method=method.upper(), url=route, auth=auth, timeout=60, **kwargs ) response.raise_for_status() return response.json()

Other Tools

Related 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