post_silence
Create or update silences in Alertmanager to temporarily suppress notifications for specific alerts.
Instructions
Post a new silence or update an existing one
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| silence | Yes |
Implementation Reference
- The main handler function for the 'post_silence' MCP tool. It is decorated with @mcp.tool, which also serves as registration. The function takes a silence dict and POSTs it to the Alertmanager API via make_request, returning the response.@mcp.tool(description="Post a new silence or update an existing one") async def post_silence(silence: Dict[str, Any]): """Post a new silence or update an existing one Parameters ---------- silence : dict A dict representing the silence to be posted. This dict should contain the following keys: - matchers: list of matchers to match alerts to silence - startsAt: start time of the silence - endsAt: end time of the silence - createdBy: name of the user creating the silence - comment: comment for the silence Returns ------- dict: Create / update silence response from Alertmanager API. """ return make_request(method="POST", route="/api/v2/silences", json=silence)
- src/alertmanager_mcp_server/server.py:377-377 (registration)The @mcp.tool decorator registers the post_silence function as an MCP tool.@mcp.tool(description="Post a new silence or update an existing one")
- Docstring within the handler describes the expected input schema for the silence parameter.silence : dict A dict representing the silence to be posted. This dict should contain the following keys: - matchers: list of matchers to match alerts to silence - startsAt: start time of the silence - endsAt: end time of the silence - createdBy: name of the user creating the silence - comment: comment for the silence Returns ------- dict: Create / update silence response from Alertmanager API. """