UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

141 lines 7.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.registerMonitorAlertsTools = registerMonitorAlertsTools; const client_1 = require("../../client"); const schemas_1 = require("./schemas"); const errorHandler_1 = require("../common/errorHandler"); /** * Register Monitor Alerts tools with the MCP server */ function registerMonitorAlertsTools(server) { // List Notification Channels server.addTool({ name: 'list_notification_channels', description: 'List all notification channels for monitor alerts', parameters: schemas_1.listNotificationChannelsSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).monitorAlerts.getNotificationChannels(params); return JSON.stringify(result, null, 2); }) }); // Get a specific Notification Channel server.addTool({ name: 'get_notification_channel', description: 'Get details for a specific notification channel', parameters: schemas_1.getNotificationChannelSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { channelId } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.getNotificationChannel(channelId); return JSON.stringify(result, null, 2); }) }); // Create a Notification Channel server.addTool({ name: 'create_notification_channel', description: 'Create a new notification channel for monitor alerts', parameters: schemas_1.createNotificationChannelSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).monitorAlerts.createNotificationChannel(params); return JSON.stringify(result, null, 2); }) }); // Update a Notification Channel server.addTool({ name: 'update_notification_channel', description: 'Update an existing notification channel', parameters: schemas_1.updateNotificationChannelSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { channelId, ...data } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.updateNotificationChannel(channelId, data); return JSON.stringify(result, null, 2); }) }); // Delete a Notification Channel server.addTool({ name: 'delete_notification_channel', description: 'Delete a notification channel', parameters: schemas_1.deleteNotificationChannelSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { channelId } = params; await (0, client_1.createClient)(context).monitorAlerts.deleteNotificationChannel(channelId); return JSON.stringify({ success: true }, null, 2); }) }); // List Alerts for a Notification Channel server.addTool({ name: 'list_channel_alerts', description: 'List alerts associated with a specific notification channel', parameters: schemas_1.listChannelAlertsSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { channelId, ...paginationParams } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.getChannelAlerts(channelId, paginationParams); return JSON.stringify(result, null, 2); }) }); // List All Alert Definitions server.addTool({ name: 'list_alert_definitions', description: 'List all alert definitions across all service types', parameters: schemas_1.listAlertDefinitionsSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const result = await (0, client_1.createClient)(context).monitorAlerts.getAlertDefinitions(params); return JSON.stringify(result, null, 2); }) }); // List Alert Definitions for a Service Type server.addTool({ name: 'list_service_alert_definitions', description: 'List alert definitions for a specific service type', parameters: schemas_1.listServiceAlertDefinitionsSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { serviceType, ...paginationParams } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.getServiceAlertDefinitions(serviceType, paginationParams); return JSON.stringify(result, null, 2); }) }); // Get a specific Alert Definition server.addTool({ name: 'get_alert_definition', description: 'Get details for a specific alert definition', parameters: schemas_1.getAlertDefinitionSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { serviceType, alertId } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.getAlertDefinition(serviceType, alertId); return JSON.stringify(result, null, 2); }) }); // Create an Alert Definition server.addTool({ name: 'create_alert_definition', description: 'Create a new alert definition for a specific service type', parameters: schemas_1.createAlertDefinitionSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { serviceType, ...data } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.createAlertDefinition(serviceType, data); return JSON.stringify(result, null, 2); }) }); // Update an Alert Definition server.addTool({ name: 'update_alert_definition', description: 'Update an existing alert definition', parameters: schemas_1.updateAlertDefinitionSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { serviceType, alertId, ...data } = params; const result = await (0, client_1.createClient)(context).monitorAlerts.updateAlertDefinition(serviceType, alertId, data); return JSON.stringify(result, null, 2); }) }); // Delete an Alert Definition server.addTool({ name: 'delete_alert_definition', description: 'Delete an alert definition', parameters: schemas_1.deleteAlertDefinitionSchema, execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => { const { serviceType, alertId } = params; await (0, client_1.createClient)(context).monitorAlerts.deleteAlertDefinition(serviceType, alertId); return JSON.stringify({ success: true }, null, 2); }) }); } //# sourceMappingURL=tools.js.map