list_snapshots
Retrieve and filter volume snapshots by volume ID and interval type (e.g., MANUAL, HOURLY, DAILY) for effective snapshot management on CloudStack MCP Server.
Instructions
List volume snapshots
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| intervaltype | No | Interval type (MANUAL, HOURLY, DAILY, WEEKLY, MONTHLY) | |
| volumeid | No | Volume ID to filter snapshots |
Implementation Reference
- src/handlers/storage-handlers.ts:103-129 (handler)The handler function that implements the core logic for the 'list_snapshots' tool. It calls the CloudStack client to list snapshots, processes the response, and formats it as a text response.async handleListSnapshots(args: any) { const result = await this.cloudStackClient.listSnapshots(args); const snapshots = result.listsnapshotsresponse?.snapshot || []; const snapshotList = snapshots.map((snapshot: any) => ({ id: snapshot.id, name: snapshot.name, state: snapshot.state, volumeid: snapshot.volumeid, intervaltype: snapshot.intervaltype, created: snapshot.created, snapshottype: snapshot.snapshottype })); return { content: [ { type: 'text', text: `Found ${snapshotList.length} snapshots:\n\n${snapshotList .map((snap: any) => `• ${snap.name} (${snap.id})\n State: ${snap.state}\n Volume ID: ${snap.volumeid}\n Type: ${snap.snapshottype}\n Interval: ${snap.intervaltype}\n Created: ${snap.created}\n` ) .join('\n')}` } ] }; }
- The tool definition including name, description, and input schema for 'list_snapshots'.{ name: 'list_snapshots', description: 'List volume snapshots', inputSchema: { type: 'object', properties: { volumeid: { type: 'string', description: 'Volume ID to filter snapshots', }, intervaltype: { type: 'string', description: 'Interval type (MANUAL, HOURLY, DAILY, WEEKLY, MONTHLY)', }, }, additionalProperties: false, }, },
- src/server.ts:146-147 (registration)Dispatch/registration in the MCP server switch statement that routes 'list_snapshots' calls to the storage handler.case 'list_snapshots': return await this.storageHandlers.handleListSnapshots(args);
- src/cloudstack-client.ts:184-186 (helper)Supporting CloudStack client method that performs the actual API request to list snapshots.async listSnapshots(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listSnapshots', params); }