list_zones
Retrieve availability zones within CloudStack MCP Server to manage cloud resources effectively; filter results to display only currently available zones.
Instructions
List availability zones
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| available | No | Show only available zones |
Implementation Reference
- src/handlers/admin-handlers.ts:6-32 (handler)The main handler function for the 'list_zones' tool. It calls the CloudStack API via cloudStackClient.listZones, processes the response to extract zone details, formats them into a structured text response for MCP, and returns it in the expected content format.async handleListZones(args: any) { const result = await this.cloudStackClient.listZones(args); const zones = result.listzonesresponse?.zone || []; const zoneList = zones.map((zone: any) => ({ id: zone.id, name: zone.name, description: zone.description, allocationstate: zone.allocationstate, networktype: zone.networktype, localstorageenabled: zone.localstorageenabled, securitygroupsenabled: zone.securitygroupsenabled })); return { content: [ { type: 'text', text: `Found ${zoneList.length} zones:\n\n${zoneList .map((zone: any) => `• ${zone.name} (${zone.id})\n Description: ${zone.description}\n Allocation State: ${zone.allocationstate}\n Network Type: ${zone.networktype}\n Local Storage: ${zone.localstorageenabled}\n Security Groups: ${zone.securitygroupsenabled}\n` ) .join('\n')}` } ] }; }
- The tool schema definition for 'list_zones', including name, description, and input schema specifying an optional 'available' boolean parameter.{ name: 'list_zones', description: 'List availability zones', inputSchema: { type: 'object', properties: { available: { type: 'boolean', description: 'Show only available zones', default: true, }, }, additionalProperties: false, }, },
- src/server.ts:178-179 (registration)Registration/dispatch in the MCP server: in the CallToolRequestSchema handler, matches tool name 'list_zones' and delegates to adminHandlers.handleListZones.case 'list_zones': return await this.adminHandlers.handleListZones(args);
- src/cloudstack-client.ts:117-119 (helper)Helper method in CloudStackClient that makes the underlying 'listZones' API request to the CloudStack server.async listZones(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listZones', params); }