list_load_balancer_rules
Retrieve load balancer rules for specified public IP or zone on CloudStack MCP Server to manage network traffic distribution effectively.
Instructions
List load balancer rules
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_load_balancer_rules"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| publicipid | No | Public IP ID to filter rules | |
| zoneid | No | Zone ID to filter rules |
Implementation Reference
- src/handlers/network-handlers.ts:121-148 (handler)The handler function that implements the core logic of the 'list_load_balancer_rules' tool. It calls the CloudStack client to list rules, processes the response, and formats it as MCP content.
async handleListLoadBalancerRules(args: any) { const result = await this.cloudStackClient.listLoadBalancerRules(args); const rules = result.listloadbalancerrulesresponse?.loadbalancerrule || []; const ruleList = rules.map((rule: any) => ({ id: rule.id, name: rule.name, algorithm: rule.algorithm, state: rule.state, publicip: rule.publicip, publicport: rule.publicport, privateport: rule.privateport, description: rule.description })); return { content: [ { type: 'text', text: `Found ${ruleList.length} load balancer rules:\n\n${ruleList .map((rule: any) => `• ${rule.name} (${rule.id})\n Public IP: ${rule.publicip}:${rule.publicport}\n Private Port: ${rule.privateport}\n Algorithm: ${rule.algorithm}\n State: ${rule.state}\n` ) .join('\n')}` } ] }; } - The tool schema definition for 'list_load_balancer_rules', including input schema for parameters like publicipid and zoneid.
{ name: 'list_load_balancer_rules', description: 'List load balancer rules', inputSchema: { type: 'object', properties: { publicipid: { type: 'string', description: 'Public IP ID to filter rules', }, zoneid: { type: 'string', description: 'Zone ID to filter rules', }, }, additionalProperties: false, }, }, - src/server.ts:162-163 (registration)Registration of the tool in the MCP server's request handler switch statement, dispatching to the network handler.
case 'list_load_balancer_rules': return await this.networkHandlers.handleListLoadBalancerRules(args); - src/cloudstack-client.ts:209-211 (helper)Helper method in the CloudStack client that makes the actual 'listLoadBalancerRules' API request.
async listLoadBalancerRules(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listLoadBalancerRules', params); }