Skip to main content
Glama
ntk148v

alertmanager-mcp-server

get_alerts

Retrieve and filter active alerts from Alertmanager to monitor system notifications and manage incident responses.

Instructions

Get a list of alerts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
silencedNo
inhibitedNo
activeNo
countNo
offsetNo

Implementation Reference

  • The primary handler function for the 'get_alerts' MCP tool. Decorated with @mcp.tool(), it handles input parameters for filtering and pagination, validates params, fetches alerts from Alertmanager API (/api/v2/alerts), applies pagination, and returns structured results. This is the core implementation of the tool.
    @mcp.tool(description="Get a list of alerts") async def get_alerts(filter: Optional[str] = None, silenced: Optional[bool] = None, inhibited: Optional[bool] = None, active: Optional[bool] = None, count: int = DEFAULT_ALERT_PAGE, offset: int = 0): """Get a list of alerts currently in Alertmanager. Params ------ filter Filtering query (e.g. alertname=~'.*CPU.*')"), silenced If true, include silenced alerts. inhibited If true, include inhibited alerts. active If true, include active alerts. count Number of alerts to return per page (default: 10, max: 25). offset Number of alerts 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 Alert 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_ALERT_PAGE) if error: return {"error": error} params = {"active": True} if filter: params = {"filter": filter} if silenced is not None: params["silenced"] = silenced if inhibited is not None: params["inhibited"] = inhibited if active is not None: params["active"] = active # Get all alerts from the API all_alerts = make_request( method="GET", route="/api/v2/alerts", params=params) # Apply pagination and return results return paginate_results(all_alerts, 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