@takashito/linode-mcp-server
Version:
MCP server for Linode API
142 lines • 6.64 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerMonitorLogsTools = registerMonitorLogsTools;
const client_1 = require("../../client");
const schemas_1 = require("./schemas");
const errorHandler_1 = require("../common/errorHandler");
/**
* Register Monitor Logs tools with the MCP server
*/
function registerMonitorLogsTools(server) {
// List Log Streams
server.addTool({
name: 'list_log_streams',
description: 'Get a list of all log streams',
parameters: schemas_1.listLogStreamsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitorLogs.getLogStreams(params);
return JSON.stringify(result, null, 2);
})
});
// Get a specific Log Stream
server.addTool({
name: 'get_log_stream',
description: 'Get details for a specific log stream',
parameters: schemas_1.getLogStreamSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.getLogStream(streamId);
return JSON.stringify(result, null, 2);
})
});
// Create a Log Stream
server.addTool({
name: 'create_log_stream',
description: 'Create a new log stream',
parameters: schemas_1.createLogStreamSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { label, filters, aggregation } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.createLogStream({ label, filters, aggregation });
return JSON.stringify(result, null, 2);
})
});
// Update a Log Stream
server.addTool({
name: 'update_log_stream',
description: 'Update an existing log stream',
parameters: schemas_1.updateLogStreamSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.updateLogStream(streamId, data);
return JSON.stringify(result, null, 2);
})
});
// Delete a Log Stream
server.addTool({
name: 'delete_log_stream',
description: 'Delete a log stream',
parameters: schemas_1.deleteLogStreamSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId } = params;
await (0, client_1.createClient)(context).monitorLogs.deleteLogStream(streamId);
return JSON.stringify({ success: true }, null, 2);
})
});
// Get Log Stream History
server.addTool({
name: 'get_log_stream_history',
description: 'Get the history for a specific log stream',
parameters: schemas_1.getLogStreamHistorySchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { streamId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.getLogStreamHistory(streamId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
// List Log Destinations
server.addTool({
name: 'list_log_destinations',
description: 'Get a list of all log destinations',
parameters: schemas_1.listLogDestinationsSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const result = await (0, client_1.createClient)(context).monitorLogs.getLogDestinations(params);
return JSON.stringify(result, null, 2);
})
});
// Get a specific Log Destination
server.addTool({
name: 'get_log_destination',
description: 'Get details for a specific log destination',
parameters: schemas_1.getLogDestinationSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.getLogDestination(destinationId);
return JSON.stringify(result, null, 2);
})
});
// Create a Log Destination
server.addTool({
name: 'create_log_destination',
description: 'Create a new log destination',
parameters: schemas_1.createLogDestinationSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { label, type, config } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.createLogDestination({ label, type, config });
return JSON.stringify(result, null, 2);
})
});
// Update a Log Destination
server.addTool({
name: 'update_log_destination',
description: 'Update an existing log destination',
parameters: schemas_1.updateLogDestinationSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId, ...data } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.updateLogDestination(destinationId, data);
return JSON.stringify(result, null, 2);
})
});
// Delete a Log Destination
server.addTool({
name: 'delete_log_destination',
description: 'Delete a log destination',
parameters: schemas_1.deleteLogDestinationSchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId } = params;
await (0, client_1.createClient)(context).monitorLogs.deleteLogDestination(destinationId);
return JSON.stringify({ success: true }, null, 2);
})
});
// Get Log Destination History
server.addTool({
name: 'get_log_destination_history',
description: 'Get the history for a specific log destination',
parameters: schemas_1.getLogDestinationHistorySchema,
execute: (0, errorHandler_1.withErrorHandling)(async (params, context) => {
const { destinationId, ...paginationParams } = params;
const result = await (0, client_1.createClient)(context).monitorLogs.getLogDestinationHistory(destinationId, paginationParams);
return JSON.stringify(result, null, 2);
})
});
}
//# sourceMappingURL=tools.js.map