remove_alert_subscription
Unsubscribe from a Redash alert by providing the alert ID and subscription ID to remove the subscription.
Instructions
Unsubscribe from an alert
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alertId | Yes | ID of the alert | |
| subscriptionId | Yes | ID of the subscription to remove |
Implementation Reference
- src/index.ts:1109-1122 (handler)MCP tool handler for 'remove_alert_subscription' - validates inputs with Zod schema, calls the Redash client to remove the subscription, and returns the result or an error.
async function removeAlertSubscription(params: z.infer<typeof removeAlertSubscriptionSchema>) { try { const result = await redashClient.removeAlertSubscription(params.alertId, params.subscriptionId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error removing subscription ${params.subscriptionId} from alert ${params.alertId}: ${error}`); return { isError: true, content: [{ type: "text", text: `Error removing subscription ${params.subscriptionId} from alert ${params.alertId}: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:1104-1107 (schema)Zod schema for remove_alert_subscription inputs: requires alertId (number) and subscriptionId (number).
const removeAlertSubscriptionSchema = z.object({ alertId: z.coerce.number(), subscriptionId: z.coerce.number() }); - src/index.ts:2074-2085 (registration)Registration of the 'remove_alert_subscription' tool in the ListToolsRequestSchema handler, declaring its name, description, and JSON Schema input definition.
{ name: "remove_alert_subscription", description: "Unsubscribe from an alert", inputSchema: { type: "object", properties: { alertId: { type: "number", description: "ID of the alert" }, subscriptionId: { type: "number", description: "ID of the subscription to remove" } }, required: ["alertId", "subscriptionId"] } }, - src/index.ts:2479-2481 (registration)Routing of the 'remove_alert_subscription' tool name to its handler in the CallToolRequestSchema switch statement.
case "remove_alert_subscription": logger.debug(`Handling remove_alert_subscription`); return await removeAlertSubscription(removeAlertSubscriptionSchema.parse(args)); - src/redashClient.ts:994-1003 (helper)Redash API client helper method that performs the DELETE HTTP request to /api/alerts/{alertId}/subscriptions/{subscriptionId} to remove the alert subscription.
// Remove alert subscription async removeAlertSubscription(alertId: number, subscriptionId: number): Promise<{ success: boolean }> { try { await this.client.delete(`/api/alerts/${alertId}/subscriptions/${subscriptionId}`); return { success: true }; } catch (error) { logger.error(`Error removing subscription ${subscriptionId} from alert ${alertId}: ${error}`); throw new Error(`Failed to remove subscription ${subscriptionId} from alert ${alertId}: ${error instanceof Error ? error.message : String(error)}`); } }