Skip to main content
Glama
ntk148v

alertmanager-mcp-server

get_status

Retrieve the current operational status of an Alertmanager instance and its cluster.

Instructions

Get current status of an Alertmanager instance and its cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_status handler function - decorated with @mcp.tool, calls the Alertmanager /api/v2/status endpoint via make_request.
    @mcp.tool(description="Get current status of an Alertmanager instance and its cluster")
    async def get_status():
        """Get current status of an Alertmanager instance and its cluster
    
        Returns
        -------
        dict:
            The response from the Alertmanager API. This is a dictionary
            containing the response data.
        """
        return make_request(method="GET", route="/api/v2/status")
  • Registration as an MCP tool via the @mcp.tool decorator on FastMCP instance 'mcp'.
    @mcp.tool(description="Get current status of an Alertmanager instance and its cluster")
  • The make_request helper function that get_status uses to make 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 URL from base config URL and API route path.
    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}"
Behavior2/5

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

With no annotations, the description should disclose behavioral traits like read-only nature, authentication requirements, or any side effects. It only states it 'gets status,' leaving the agent to infer it is a safe read. No details on cluster status scope or limitations.

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?

The description is a single, front-loaded sentence that efficiently conveys the tool's purpose. Every word contributes to understanding.

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?

Given the tool has no parameters and no output schema, the description is moderately complete. It states the core functionality but lacks detail on return value structure or cluster specifics, which could aid agent decision-making.

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?

The input schema has no parameters, so schema coverage is 100%. The description adds no additional parameter meaning, but for a zero-parameter tool, a baseline of 4 is appropriate.

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 identifies the tool's purpose: retrieving the current status of an Alertmanager instance and its cluster. It uses a specific verb and resource, distinguishing it from sibling tools that focus on alerts, silences, or receivers.

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 usage guidelines are provided. The description does not specify when to use this tool versus alternatives, nor does it mention any prerequisites or contextual conditions for invoking it.

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