Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_hosts

Retrieve and filter hosts in Apache CloudStack based on zone, type, state, or hypervisor. Manage cloud infrastructure efficiently with this MCP tool.

Instructions

List hosts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hypervisorNoHypervisor type
stateNoHost state
typeNoHost type (Routing, Storage, etc.)
zoneidNoZone ID to filter hosts

Implementation Reference

  • The main handler function for the 'list_hosts' tool. It queries the CloudStack API via the client, extracts host data, maps it to a simplified structure, and formats a detailed text response listing all hosts with their key attributes.
    async handleListHosts(args: any) {
      const result = await this.cloudStackClient.listHosts(args);
      const hosts = result.listhostsresponse?.host || [];
      
      const hostList = hosts.map((host: any) => ({
        id: host.id,
        name: host.name,
        type: host.type,
        state: host.state,
        ipaddress: host.ipaddress,
        zonename: host.zonename,
        clustername: host.clustername,
        hypervisor: host.hypervisor,
        cpunumber: host.cpunumber,
        cpuspeed: host.cpuspeed,
        memorytotal: host.memorytotal,
        memoryused: host.memoryused
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: `Found ${hostList.length} hosts:\n\n${hostList
              .map((host: any) => 
                `• ${host.name} (${host.id})\n  Type: ${host.type}\n  State: ${host.state}\n  IP: ${host.ipaddress}\n  Zone: ${host.zonename}\n  Cluster: ${host.clustername}\n  Hypervisor: ${host.hypervisor}\n  CPUs: ${host.cpunumber} @ ${host.cpuspeed}MHz\n  Memory: ${host.memoryused}/${host.memorytotal}MB\n`
              )
              .join('\n')}`
          }
        ]
      };
    }
  • Tool schema definition for 'list_hosts', including name, description, and input schema specifying optional parameters like zoneid, type, state, hypervisor.
    {
      name: 'list_hosts',
      description: 'List hosts',
      inputSchema: {
        type: 'object',
        properties: {
          zoneid: {
            type: 'string',
            description: 'Zone ID to filter hosts',
          },
          type: {
            type: 'string',
            description: 'Host type (Routing, Storage, etc.)',
          },
          state: {
            type: 'string',
            description: 'Host state',
          },
          hypervisor: {
            type: 'string',
            description: 'Hypervisor type',
          },
        },
        additionalProperties: false,
      },
    },
  • src/server.ts:188-189 (registration)
    Registers the 'list_hosts' tool in the MCP server's CallToolRequest handler by mapping the tool name to the adminHandlers.handleListHosts method.
    case 'list_hosts':
      return await this.adminHandlers.handleListHosts(args);
  • Helper method in CloudStackClient that wraps the generic API request for the 'listHosts' CloudStack API endpoint.
    async listHosts(params: CloudStackParams = {}): Promise<CloudStackResponse> {
      return this.request('listHosts', params);
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'List hosts' gives no information about whether this is a read-only operation, if it requires authentication, what the output format might be, or any rate limits. It fails to describe any behavioral traits beyond the basic action implied by the name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While 'List hosts' is extremely concise, it's under-specified rather than efficiently informative. The single phrase doesn't front-load critical information or provide any structure. It fails to earn its place by adding value beyond the tool name, making it inadequate despite its brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a tool with 4 parameters and no output schema or annotations, the description is completely inadequate. It doesn't explain what 'hosts' are in this context, what the listing includes, or how to interpret results. For a tool that likely returns structured data about infrastructure resources, this leaves significant gaps in understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear parameter descriptions (e.g., 'Hypervisor type', 'Host state'). The tool description adds no additional parameter semantics beyond what the schema already provides. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even without param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List hosts' is a tautology that merely restates the tool name without adding any meaningful context. It doesn't specify what kind of hosts (e.g., virtual machine hosts, network hosts) or what information is included in the listing. While it indicates a listing action, it lacks the specificity needed to distinguish it from other list tools in the sibling set.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for filtering hosts, or how it differs from other list tools like 'list_virtual_machines' or 'list_system_vms' in the sibling set. This leaves the agent with no usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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