create_volume
Generate a new storage volume in CloudStack MCP Server by specifying essential parameters like name, disk offering ID, zone ID, and optional custom size, enabling efficient resource allocation for cloud infrastructure.
Instructions
Create a new volume
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| diskofferingid | Yes | Disk offering ID | |
| name | Yes | Volume name | |
| size | No | Volume size in GB (for custom disk offerings) | |
| zoneid | Yes | Zone ID |
Implementation Reference
- src/handlers/storage-handlers.ts:38-49 (handler)The main handler function for the 'create_volume' tool. It calls the CloudStack client's createVolume method with the provided arguments and returns a formatted response with the job ID and volume ID.async handleCreateVolume(args: any) { const result = await this.cloudStackClient.createVolume(args); return { content: [ { type: 'text', text: `Created volume. Job ID: ${result.createvolumeresponse?.jobid}\nVolume ID: ${result.createvolumeresponse?.id}` } ] }; }
- Defines the tool metadata including name, description, and input schema (parameters: name, diskofferingid, zoneid required; size optional).{ name: 'create_volume', description: 'Create a new volume', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Volume name', }, diskofferingid: { type: 'string', description: 'Disk offering ID', }, zoneid: { type: 'string', description: 'Zone ID', }, size: { type: 'number', description: 'Volume size in GB (for custom disk offerings)', }, }, required: ['name', 'diskofferingid', 'zoneid'], additionalProperties: false, }, },
- src/server.ts:136-137 (registration)Registers the 'create_volume' tool in the MCP server's CallToolRequestHandler by dispatching to the StorageHandlers.handleCreateVolume method.case 'create_volume': return await this.storageHandlers.handleCreateVolume(args);
- src/cloudstack-client.ts:164-166 (helper)Helper method in CloudStackClient that makes the actual 'createVolume' API request to the CloudStack server, invoked by the tool handler.async createVolume(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('createVolume', params); }