create_snapshot
Generate a snapshot of a specified volume in Apache CloudStack using the CloudStack MCP Server, ensuring data preservation and recovery readiness by providing the volume ID and optional snapshot name.
Instructions
Create a snapshot of a volume
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Snapshot name | |
| volumeid | Yes | Volume ID to snapshot |
Implementation Reference
- src/handlers/storage-handlers.ts:90-101 (handler)The handler function that executes the create_snapshot tool logic. It calls the CloudStack client to create the snapshot and returns a formatted text response with job ID and snapshot ID.async handleCreateSnapshot(args: any) { const result = await this.cloudStackClient.createSnapshot(args); return { content: [ { type: 'text', text: `Created snapshot of volume ${args.volumeid}. Job ID: ${result.createsnapshotresponse?.jobid}\nSnapshot ID: ${result.createsnapshotresponse?.id}` } ] }; }
- Input schema definition for the create_snapshot tool, specifying required volumeid and optional name.{ name: 'create_snapshot', description: 'Create a snapshot of a volume', inputSchema: { type: 'object', properties: { volumeid: { type: 'string', description: 'Volume ID to snapshot', }, name: { type: 'string', description: 'Snapshot name', }, }, required: ['volumeid'], additionalProperties: false, }, },
- src/server.ts:144-145 (registration)Tool registration/dispatch in the MCP server: maps 'create_snapshot' calls to the storage handler.case 'create_snapshot': return await this.storageHandlers.handleCreateSnapshot(args);
- src/cloudstack-client.ts:180-182 (helper)Helper method in CloudStack client that makes the underlying API request for createSnapshot.async createSnapshot(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('createSnapshot', params); }