Skip to main content
Glama
ntk148v

alertmanager-mcp-server

get_receivers

Fetch the list of all receivers (notification integration names) from Alertmanager.

Instructions

Get list of all receivers (name of notification integrations)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the get_receivers tool. Decorated with @mcp.tool, it makes a GET request to the Alertmanager API endpoint /api/v2/receivers.
    @mcp.tool(description="Get list of all receivers (name of notification integrations)")
    async def get_receivers():
        """Get list of all receivers (name of notification integrations)
    
        Returns
        -------
        list:
            Return a list of Receiver objects from Alertmanager instance.
        """
        return make_request(method="GET", route="/api/v2/receivers")
  • The tool is registered via the @mcp.tool decorator on the FastMCP instance 'mcp' (created at line 60).
    @mcp.tool(description="Get list of all receivers (name of notification integrations)")
  • The make_request helper function used by get_receivers to perform HTTP GET requests 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 url_join helper used by make_request to construct the full API URL.
    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}"
Behavior3/5

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

No annotations are provided, so the description must convey behavioral traits. It states 'Get list' implying a non-destructive read, but does not disclose any additional behaviors such as authentication needs or performance constraints.

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

Conciseness5/5

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

Description is a single sentence with no extraneous information. It is front-loaded and efficient.

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

Completeness5/5

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

For a simple list tool with no parameters and no output schema, the description provides sufficient context. The return value (list of receiver names) is implicitly clear.

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

Parameters4/5

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

Tool has 0 parameters and schema coverage is 100%, so the description adds meaning by naming the resource and clarifying it refers to notification integration names, which goes beyond the empty 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?

Description clearly states verb 'Get list' and resource 'receivers' with parenthetical clarification 'name of notification integrations'. It distinguishes this read operation from sibling tools that manage alerts, silences, and status.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool versus alternatives. While siblings are mostly for alerts and silences, the description does not provide context for selection or exclusions.

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