attach_volume
Link a storage volume to a virtual machine using Volume ID and VM ID on the CloudStack MCP Server, enabling efficient resource management and storage allocation.
Instructions
Attach volume to virtual machine
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceid | No | Device ID | |
| id | Yes | Volume ID | |
| virtualmachineid | Yes | VM ID to attach to |
Implementation Reference
- src/handlers/storage-handlers.ts:51-62 (handler)The handler function that executes the attach_volume tool logic by calling the CloudStack client to attach the volume and returning a formatted success message.async handleAttachVolume(args: any) { const result = await this.cloudStackClient.attachVolume(args); return { content: [ { type: 'text', text: `Attached volume ${args.id} to VM ${args.virtualmachineid}. Job ID: ${result.attachvolumeresponse?.jobid}` } ] }; }
- Defines the tool name, description, and input schema (parameters with types and requirements) for attach_volume.{ name: 'attach_volume', description: 'Attach volume to virtual machine', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Volume ID', }, virtualmachineid: { type: 'string', description: 'VM ID to attach to', }, deviceid: { type: 'number', description: 'Device ID', }, }, required: ['id', 'virtualmachineid'], additionalProperties: false, }, },
- src/server.ts:138-139 (registration)Registers and dispatches the attach_volume tool call to the corresponding storage handler method.case 'attach_volume': return await this.storageHandlers.handleAttachVolume(args);