delete_silence
Remove or expire an existing alert silence in Kubernetes clusters to restore monitoring for specific alerts.
Instructions
Delete (expire) an existing silence
Args: silence_id: ID of the silence to delete cluster: Cluster where the silence exists
Returns: Deletion result
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| silence_id | Yes | ||
| cluster | Yes |
Implementation Reference
- src/karma_mcp/server.py:1363-1419 (handler)The handler function 'delete_silence' implements the tool logic to verify existence and prepare a deletion request for a silence in a specified cluster.
async def delete_silence(silence_id: str, cluster: str) -> str: """Delete (expire) an existing silence Args: silence_id: ID of the silence to delete cluster: Cluster where the silence exists Returns: Deletion result """ try: # First verify the silence exists async with httpx.AsyncClient() as client: response = await client.post( f"{KARMA_URL}/alerts.json", json={}, headers={"Content-Type": "application/json"}, timeout=10.0, ) if response.status_code != 200: return ( f"Error fetching silence information: code {response.status_code}" ) data = response.json() silences = data.get("silences", {}).get(cluster, {}) if silence_id not in silences: # Try to find with partial match found = False for sid in silences: if silence_id in sid: silence_id = sid found = True break if not found: return f"Silence ID {silence_id} not found in cluster {cluster}" silence_info = silences.get(silence_id, {}) return f""" ā ļø Silence Deletion Request: š Silence ID: {silence_id} š Cluster: {cluster} š¬ Original comment: {silence_info.get("comment", "N/A")} š¤ Created by: {silence_info.get("createdBy", "unknown")} Note: Direct Alertmanager API integration is required to complete this deletion. To manually delete this silence, use the Karma UI or Alertmanager API directly. """ except Exception as e: return f"Error deleting silence: {str(e)}" - src/karma_mcp/http_server.py:84-87 (schema)The Pydantic model 'DeleteSilenceRequest' defines the input schema for the delete_silence tool.
class DeleteSilenceRequest(BaseModel): silence_id: str cluster: str - src/karma_mcp/http_server.py:112-112 (registration)The route for deleting silences is registered as a DELETE endpoint on '/silences' in the FastAPI app.
"DELETE /silences - Delete an existing silence",