list_public_ip_addresses
Retrieve and filter public IP addresses in CloudStack zones using zone ID, allocation status, and static NAT configuration for efficient network management.
Instructions
List public IP addresses
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| allocatedonly | No | Show only allocated IPs | |
| isstaticnat | No | Filter by static NAT enabled | |
| zoneid | No | Zone ID to filter IPs |
Implementation Reference
- src/handlers/network-handlers.ts:52-80 (handler)Executes the list_public_ip_addresses tool by calling CloudStack API via client, processes the response, and returns formatted list of public IP addresses.
async handleListPublicIpAddresses(args: any) { const result = await this.cloudStackClient.listPublicIpAddresses(args); const ips = result.listpublicipaddressesresponse?.publicipaddress || []; const ipList = ips.map((ip: any) => ({ id: ip.id, ipaddress: ip.ipaddress, state: ip.state, zonename: ip.zonename, allocated: ip.allocated, issourcenat: ip.issourcenat, isstaticnat: ip.isstaticnat, virtualmachineid: ip.virtualmachineid, virtualmachinename: ip.virtualmachinename })); return { content: [ { type: 'text', text: `Found ${ipList.length} public IP addresses:\n\n${ipList .map((ip: any) => `• ${ip.ipaddress} (${ip.id})\n State: ${ip.state}\n Zone: ${ip.zonename}\n Allocated: ${ip.allocated}\n Source NAT: ${ip.issourcenat}\n Static NAT: ${ip.isstaticnat}\n VM: ${ip.virtualmachinename || 'Not assigned'}\n` ) .join('\n')}` } ] }; } - Defines the tool schema including name, description, and inputSchema for list_public_ip_addresses.
{ name: 'list_public_ip_addresses', description: 'List public IP addresses', inputSchema: { type: 'object', properties: { zoneid: { type: 'string', description: 'Zone ID to filter IPs', }, allocatedonly: { type: 'boolean', description: 'Show only allocated IPs', default: true, }, isstaticnat: { type: 'boolean', description: 'Filter by static NAT enabled', }, }, additionalProperties: false, }, }, - src/server.ts:154-155 (registration)Registers the tool handler in the MCP server switch statement, routing calls to NetworkHandlers.handleListPublicIpAddresses.
case 'list_public_ip_addresses': return await this.networkHandlers.handleListPublicIpAddresses(args); - src/cloudstack-client.ts:193-194 (helper)CloudStackClient method that makes the underlying API request for listPublicIpAddresses.
async listPublicIpAddresses(params: CloudStackParams = {}): Promise<CloudStackResponse> { return this.request('listPublicIpAddresses', params);