Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

list_security_groups

Retrieve and filter security groups in Apache CloudStack by name or associated virtual machine ID. Manage cloud resources efficiently with this integration tool.

Instructions

List security groups

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
securitygroupnameNoSecurity group name to filter
virtualmachineidNoVM ID to show associated security groups

Implementation Reference

  • The main handler function for the 'list_security_groups' tool. It calls the CloudStack client to list security groups, processes the response, and formats it as a text content block for the MCP response.
    async handleListSecurityGroups(args: any) { const result = await this.cloudStackClient.listSecurityGroups(args); const securityGroups = result.listsecuritygroupsresponse?.securitygroup || []; const securityGroupList = securityGroups.map((sg: any) => ({ id: sg.id, name: sg.name, description: sg.description, account: sg.account, domain: sg.domain, ingressrule: sg.ingressrule || [], egressrule: sg.egressrule || [] })); return { content: [ { type: 'text', text: `Found ${securityGroupList.length} security groups:\n\n${securityGroupList .map((sg: any) => `• ${sg.name} (${sg.id})\n Description: ${sg.description}\n Account: ${sg.account}\n Domain: ${sg.domain}\n Ingress Rules: ${sg.ingressrule.length}\n Egress Rules: ${sg.egressrule.length}\n` ) .join('\n')}` } ] }; }
  • The tool definition including name, description, and input schema for 'list_security_groups'.
    { name: 'list_security_groups', description: 'List security groups', inputSchema: { type: 'object', properties: { securitygroupname: { type: 'string', description: 'Security group name to filter', }, virtualmachineid: { type: 'string', description: 'VM ID to show associated security groups', }, }, additionalProperties: false, }, },
  • src/server.ts:204-205 (registration)
    Registration and dispatch of the 'list_security_groups' tool in the MCP server's CallToolRequestSchema handler switch statement.
    case 'list_security_groups': return await this.securityHandlers.handleListSecurityGroups(args);
  • Helper method in CloudStackClient that performs the actual API request to CloudStack's listSecurityGroups endpoint.
    async listSecurityGroups(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listSecurityGroups', 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