@takashito/linode-mcp-server
Version:
MCP server for Linode API
59 lines • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerStackScriptsTools = registerStackScriptsTools;
const schemas_1 = require("./schemas");
const errorHandler_1 = require("../common/errorHandler");
/**
* Register StackScripts tools with the MCP server
*/
function registerStackScriptsTools(server, client) {
// List StackScripts
server.tool('list_stackscripts', 'Get a list of all StackScripts', schemas_1.listStackScriptsSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.stackScripts.getStackScripts(params);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) }
]
};
}));
// Get a specific StackScript
server.tool('get_stackscript', 'Get details for a specific StackScript', schemas_1.getStackScriptSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const { id } = params;
const result = await client.stackScripts.getStackScript(id);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) }
]
};
}));
// Create a StackScript
server.tool('create_stackscript', 'Create a new StackScript', schemas_1.createStackScriptSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const result = await client.stackScripts.createStackScript(params);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) }
]
};
}));
// Update a StackScript
server.tool('update_stackscript', 'Update an existing StackScript', schemas_1.updateStackScriptSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const { id, ...data } = params;
const result = await client.stackScripts.updateStackScript(id, data);
return {
content: [
{ type: 'text', text: JSON.stringify(result, null, 2) }
]
};
}));
// Delete a StackScript
server.tool('delete_stackscript', 'Delete a StackScript', schemas_1.deleteStackScriptSchema.shape, (0, errorHandler_1.withErrorHandling)(async (params, extra) => {
const { id } = params;
await client.stackScripts.deleteStackScript(id);
return {
content: [
{ type: 'text', text: JSON.stringify({ success: true }, null, 2) }
]
};
}));
}
//# sourceMappingURL=tools.js.map