Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_accounts

Retrieve and filter accounts within a domain on the CloudStack MCP Server by account type or state to manage user roles and access effectively.

Instructions

List accounts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accounttypeNoAccount type (0=User, 1=Admin, 2=DomainAdmin)
domainidNoDomain ID to filter accounts
stateNoAccount state

Implementation Reference

  • MCP tool handler function that executes list_accounts: calls CloudStack API via client, processes accounts, formats as text response.
    async handleListAccounts(args: any) {
      const result = await this.cloudStackClient.listAccounts(args);
      const accounts = result.listaccountsresponse?.account || [];
      
      const accountList = accounts.map((account: any) => ({
        id: account.id,
        name: account.name,
        accounttype: account.accounttype,
        domain: account.domain,
        state: account.state,
        receivedbytes: account.receivedbytes,
        sentbytes: account.sentbytes
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: `Found ${accountList.length} accounts:\n\n${accountList
              .map((account: any) => 
                `• ${account.name} (${account.id})\n  Type: ${account.accounttype}\n  Domain: ${account.domain}\n  State: ${account.state}\n  Received: ${account.receivedbytes} bytes\n  Sent: ${account.sentbytes} bytes\n`
              )
              .join('\n')}`
          }
        ]
      };
    }
  • Tool definition and input schema for list_accounts tool.
    {
      name: 'list_accounts',
      description: 'List accounts',
      inputSchema: {
        type: 'object',
        properties: {
          domainid: {
            type: 'string',
            description: 'Domain ID to filter accounts',
          },
          state: {
            type: 'string',
            description: 'Account state',
          },
          accounttype: {
            type: 'number',
            description: 'Account type (0=User, 1=Admin, 2=DomainAdmin)',
          },
        },
        additionalProperties: false,
      },
    },
  • src/server.ts:182-183 (registration)
    Tool dispatch/registration in the MCP server request handler switch statement.
    case 'list_accounts':
      return await this.adminHandlers.handleListAccounts(args);
  • CloudStack client helper method that makes the underlying listAccounts API request.
    async listAccounts(params: CloudStackParams = {}): Promise<CloudStackResponse> {
      return this.request('listAccounts', 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