list_alerts
Lists all alerts in your Redash instance, summarizing each alert's configuration and status.
Instructions
List all alerts in Redash
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:912-925 (handler)Handler function for the 'list_alerts' tool. Calls redashClient.getAlerts() and returns the result as JSON.
async function listAlerts() { try { const result = await redashClient.getAlerts(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error listing alerts: ${error}`); return { isError: true, content: [{ type: "text", text: `Error listing alerts: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:1959-1967 (registration)Registration of the 'list_alerts' tool in ListToolsRequestSchema, defining its name, description, and input schema (empty object).
// Alert tools { name: "list_alerts", description: "List all alerts in Redash", inputSchema: { type: "object", properties: {} } }, - src/index.ts:2446-2449 (registration)Dispatch/case handler for 'list_alerts' in CallToolRequestSchema switch statement, calling the listAlerts() function.
// Alert tools case "list_alerts": logger.debug(`Handling list_alerts`); return await listAlerts(); - src/redashClient.ts:906-915 (helper)The getAlerts() method on RedashClient that makes the actual HTTP GET /api/alerts call to the Redash API.
// Get all alerts async getAlerts(): Promise<RedashAlert[]> { try { const response = await this.client.get('/api/alerts'); return response.data; } catch (error) { logger.error(`Error fetching alerts: ${error}`); throw new Error(`Failed to fetch alerts: ${error instanceof Error ? error.message : String(error)}`); } }