Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_domains

Retrieve domain details in an Apache CloudStack environment by specifying domain level or name using the MCP-enabled server tool for efficient cloud resource management.

Instructions

List domains

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelNoDomain level
nameNoDomain name

Implementation Reference

  • The handler function that implements the core logic for the 'list_domains' tool. It queries the CloudStack client for domains, processes the response, formats it into a readable list, and returns it in the MCP content format.
    async handleListDomains(args: any) { const result = await this.cloudStackClient.listDomains(args); const domains = result.listdomainsresponse?.domain || []; const domainList = domains.map((domain: any) => ({ id: domain.id, name: domain.name, path: domain.path, level: domain.level, parentdomainid: domain.parentdomainid, parentdomainname: domain.parentdomainname, haschild: domain.haschild, state: domain.state })); return { content: [ { type: 'text', text: `Found ${domainList.length} domains:\n\n${domainList .map((domain: any) => `• ${domain.name} (${domain.id})\n Path: ${domain.path}\n Level: ${domain.level}\n Parent: ${domain.parentdomainname || 'None'}\n Has Children: ${domain.haschild}\n State: ${domain.state}\n` ) .join('\n')}` } ] }; }
  • The tool definition including name, description, and input schema for 'list_domains', which specifies optional parameters for filtering domains by level or name.
    name: 'list_domains', description: 'List domains', inputSchema: { type: 'object', properties: { level: { type: 'number', description: 'Domain level', }, name: { type: 'string', description: 'Domain name', }, }, additionalProperties: false, }, },
  • src/server.ts:186-187 (registration)
    The dispatch case in the CallToolRequest handler that registers and routes calls to the 'list_domains' tool to its specific handler method.
    case 'list_domains': return await this.adminHandlers.handleListDomains(args);
  • Supporting method in the CloudStack client that makes the underlying API request to 'listDomains' endpoint.
    async listDomains(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listDomains', 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