Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

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
NameRequiredDescriptionDefault
availableNoShow only available zones

Implementation Reference

  • 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);
  • 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);
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/phantosmax/cloudstack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server