list_storage_pools
Retrieve and filter storage pools in CloudStack MCP Server by specifying Zone ID or Cluster ID for efficient cloud resource management.
Instructions
List storage pools
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clusterid | No | Cluster ID to filter storage pools | |
| zoneid | No | Zone ID to filter storage pools |
Implementation Reference
- src/handlers/admin-handlers.ts:213-242 (handler)The main handler function that executes the list_storage_pools tool logic. It fetches storage pools via CloudStack client, maps relevant fields, and returns a formatted text response listing pools with details like name, ID, type, state, zone, cluster, IP, path, and disk usage.async handleListStoragePools(args: any) { const result = await this.cloudStackClient.listStoragePools(args); const pools = result.liststoragepoolsresponse?.storagepool || []; const poolList = pools.map((pool: any) => ({ id: pool.id, name: pool.name, type: pool.type, state: pool.state, zonename: pool.zonename, clustername: pool.clustername, ipaddress: pool.ipaddress, path: pool.path, disksizeused: pool.disksizeused, disksizetotal: pool.disksizetotal })); return { content: [ { type: 'text', text: `Found ${poolList.length} storage pools:\n\n${poolList .map((pool: any) => `• ${pool.name} (${pool.id})\n Type: ${pool.type}\n State: ${pool.state}\n Zone: ${pool.zonename}\n Cluster: ${pool.clustername}\n IP: ${pool.ipaddress}\n Path: ${pool.path}\n Usage: ${pool.disksizeused}/${pool.disksizetotal} GB\n` ) .join('\n')}` } ] }; }
- Tool schema definition specifying the name, description, and input schema allowing optional zoneid and clusterid filters.{ name: 'list_storage_pools', description: 'List storage pools', inputSchema: { type: 'object', properties: { zoneid: { type: 'string', description: 'Zone ID to filter storage pools', }, clusterid: { type: 'string', description: 'Cluster ID to filter storage pools', }, }, additionalProperties: false, }, },
- src/server.ts:192-193 (registration)Registration and dispatch logic in the MCP server that maps the tool name to the corresponding admin handler method.case 'list_storage_pools': return await this.adminHandlers.handleListStoragePools(args);
- src/cloudstack-client.ts:264-266 (helper)Supporting utility method in CloudStackClient that performs the actual API request to the 'listStoragePools' CloudStack endpoint.async listStoragePools(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listStoragePools', params); }