UNPKG

@takashito/linode-mcp-server

Version:

MCP server for Linode API

109 lines 4.53 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.registerVolumeTools = registerVolumeTools; const schemas = __importStar(require("./schemas")); function registerVolumeTools(server, client) { // Register volume tools server.tool('list_volumes', 'Get a list of all volumes', schemas.listVolumesSchema.shape, async (params, extra) => { const result = await client.volumes.getVolumes(params); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('get_volume', 'Get details for a specific volume', schemas.getVolumeSchema.shape, async (params, extra) => { const result = await client.volumes.getVolumeById(params.id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('create_volume', 'Create a new volume', schemas.createVolumeSchema.shape, async (params, extra) => { const createData = { region: String(params.region), size: Number(params.size), label: String(params.label), linode_id: params.linode_id ? Number(params.linode_id) : undefined, tags: params.tags, config_id: params.config_id ? Number(params.config_id) : undefined, encryption: params.encryption }; const result = await client.volumes.createVolume(createData); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('delete_volume', 'Delete a volume', schemas.deleteVolumeSchema.shape, async (params, extra) => { const result = await client.volumes.deleteVolume(params.id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('attach_volume', 'Attach a volume to a Linode instance', schemas.attachVolumeSchema.shape, async (params, extra) => { const result = await client.volumes.attachVolume(params.id, { linode_id: params.linode_id, config_id: params.config_id, }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('detach_volume', 'Detach a volume from a Linode instance', schemas.detachVolumeSchema.shape, async (params, extra) => { const result = await client.volumes.detachVolume(params.id); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); server.tool('resize_volume', 'Resize a volume', schemas.resizeVolumeSchema.shape, async (params, extra) => { const result = await client.volumes.resizeVolume(params.id, { size: params.size }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) }, ], }; }); } //# sourceMappingURL=tools.js.map