@takashito/linode-mcp-server
Version:
MCP server for Linode API
103 lines • 4.89 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerMonitorMetricsTools = registerMonitorMetricsTools;
const client_1 = require("../../client");
const schemas_1 = require("./schemas");
const errorHandler_1 = require("../common/errorHandler");
/**
* Register Monitor Metrics tools with the MCP server
*/
function registerMonitorMetricsTools(server) {
// List Monitor Dashboards
server.addTool({
name: 'list_monitor_dashboards',
description: 'List all monitor dashboards',
parameters: schemas_1.listMonitorDashboardsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitorMetrics.listDashboards(params);
return JSON.stringify(result, null, 2);
})
});
// Get a specific Monitor Dashboard
server.addTool({
name: 'get_monitor_dashboard',
description: 'Get details for a specific monitor dashboard',
parameters: schemas_1.getMonitorDashboardSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { dashboardId } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.getDashboard(dashboardId);
return JSON.stringify(result, null, 2);
})
});
// List Monitor Services
server.addTool({
name: 'list_monitor_services',
description: 'List all supported monitoring service types',
parameters: schemas_1.listMonitorServicesSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitorMetrics.listServices(params);
return JSON.stringify(result, null, 2);
})
});
// Get a specific Monitor Service
server.addTool({
name: 'get_monitor_service',
description: 'Get details for a specific supported monitoring service type',
parameters: schemas_1.getMonitorServiceSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.getService(serviceType);
return JSON.stringify(result, null, 2);
})
});
// List Service Dashboards
server.addTool({
name: 'list_service_dashboards',
description: 'List dashboards for a specific monitoring service type',
parameters: schemas_1.listServiceDashboardsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.listServiceDashboards(serviceType, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// List Service Metric Definitions
server.addTool({
name: 'list_service_metric_definitions',
description: 'List metric definitions for a specific monitoring service type',
parameters: schemas_1.listServiceMetricDefinitionsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.listServiceMetricDefinitions(serviceType);
return JSON.stringify(result, null, 2);
})
});
// Get Service Metrics
server.addTool({
name: 'get_service_metrics',
description: 'Get metrics for entities of a specific monitoring service type',
parameters: schemas_1.getServiceMetricsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType, entity_ids, start_time, end_time, time_granularity } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.getServiceMetrics(serviceType, {
entity_ids,
start_time,
end_time,
time_granularity
});
return JSON.stringify(result, null, 2);
})
});
// Create Service Token
server.addTool({
name: 'create_service_token',
description: 'Create a token for a specific monitoring service type',
parameters: schemas_1.createServiceTokenSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { serviceType } = params;
const result = await (0, client_1.createClient)(context).monitorMetrics.createServiceToken(serviceType);
return JSON.stringify(result, null, 2);
})
});
}
//# sourceMappingURL=tools.js.map