UNPKG

@sentio/mcp

Version:

sentio mcp

64 lines (63 loc) 1.83 kB
import { AlertsService } from "@sentio/api"; import z from "zod"; export function registerAlertsTools(server, client, options) { server.tool("deleteAlertRule", "Delete an alert rule", { id: z.string().describe("Alert rule ID"), }, async ({ id }) => { const response = await AlertsService.deleteAlertRule({ path: { id }, client }); if (response.error) { throw response.error; } return { content: [{ type: "text", text: JSON.stringify(response.data) }] }; }); server.tool("saveAlertRule", "Save an alert rule", { id: z.string().describe("Alert rule ID"), rule: z.object({}).passthrough().describe("Alert rule configuration"), }, async ({ id, rule }) => { const response = await AlertsService.saveAlertRule2({ path: { id }, body: rule, client }); if (response.error) { throw response.error; } return { content: [{ type: "text", text: JSON.stringify(response.data) }] }; }); server.tool("getAlert", "Get alerts for a specific rule", { ruleId: z.string().describe("Alert rule ID"), }, async ({ ruleId }) => { const response = await AlertsService.getAlert({ path: { ruleId }, client }); if (response.error) { throw response.error; } return { content: [{ type: "text", text: JSON.stringify(response.data) }] }; }); }