Skip to main content
Glama
ntk148v

alertmanager-mcp-server

post_alerts

Create and send alerts to Alertmanager for processing and notification.

Instructions

Create new alerts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alertsYes

Implementation Reference

  • The tool handler for post_alerts, decorated with @mcp.tool, that takes a list of alert dicts and sends them as a POST request to the Alertmanager API at /api/v2/alerts.
    @mcp.tool(description="Create new alerts")
    async def post_alerts(alerts: List[Dict]):
        """Create new alerts
    
        Parameters
        ----------
        alerts
            A list of Alert object.
            [
                {
                    "startsAt": datetime,
                    "endsAt": datetime,
                    "annotations": labelSet
                }
            ]
    
        Returns
        -------
        dict:
            Create alert response from Alertmanager API.
        """
        return make_request(method="POST", route="/api/v2/alerts", json=alerts)
  • Registration of post_alerts as an MCP tool via the @mcp.tool decorator on FastMCP instance 'mcp'.
    @mcp.tool(description="Create new alerts")
  • The make_request helper function that performs the actual HTTP request to the Alertmanager API, used by post_alerts.
    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 FastMCP instance on which the @mcp.tool decorator registers tools like post_alerts.
    mcp = FastMCP("Alertmanager MCP")
  • The input schema for post_alerts is defined by the type hint List[Dict] on the alerts parameter.
    @mcp.tool(description="Create new alerts")
    async def post_alerts(alerts: List[Dict]):
Behavior2/5

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

Without annotations, the description must disclose behavioral traits. 'Create' implies mutation, but there is no mention of side effects, authentication needs, or impact on existing data. The description is too minimal.

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

Conciseness2/5

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

The description is extremely concise at one sentence, but it under-specifies the tool. Given the vague schema, more detail is warranted, making this brevity a deficiency rather than a virtue.

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

Completeness1/5

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

The tool has one complex parameter (array of objects) and no output schema. The description fails to explain what constitutes an alert or how the response looks, leaving the agent without sufficient information to use the tool correctly.

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

Parameters1/5

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

The input schema covers 0% of parameter descriptions, and 'Create new alerts' adds no meaning to the 'alerts' parameter. The parameter is an array of objects with 'additionalProperties: true', but the description fails to clarify required fields or expected structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create new alerts' clearly identifies the action (create) and resource (alerts), distinguishing it from sibling get/delete tools. However, it does not elaborate on the type or scope of alerts being created.

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 is provided on when to use this tool versus alternatives like 'post_silence'. The description lacks context for appropriate usage 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