get_ip_pool_usage
Retrieve IP pool allocation details including total, allocated, and free addresses to monitor and manage IP address utilization in VMware NSX environments.
Instructions
Get IP pool allocation usage details (total, allocated, free).
Args: pool_id: The IP pool ID. target: Optional NSX Manager target name from config. Uses default if omitted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pool_id | Yes | ||
| target | No |
Implementation Reference
- vmware_nsx/ops/networking.py:231-254 (handler)The actual implementation of the get_ip_pool_usage function, which queries the NSX API and returns IP allocation details.
def get_ip_pool_usage(client: NsxClient, pool_id: str) -> dict: """Get IP allocation details for a specific IP pool. Args: client: Authenticated NSX API client. pool_id: IP pool identifier. Returns: Dict with pool info and list of current allocations. """ path = f"/policy/api/v1/infra/ip-pools/{pool_id}/ip-allocations" allocations = client.get_all(path) return { "pool_id": pool_id, "allocation_count": len(allocations), "allocations": [ { "id": _sanitize(a.get("id", "")), "display_name": _sanitize(a.get("display_name", "")), "allocation_ip": _sanitize(a.get("allocation_ip", "")), } for a in allocations ], } - mcp_server/server.py:268-279 (registration)The MCP tool registration for get_ip_pool_usage, which calls the helper in vmware_nsx.ops.networking.
@mcp.tool() def get_ip_pool_usage(pool_id: str, target: str | None = None) -> dict: """Get IP pool allocation usage details (total, allocated, free). Args: pool_id: The IP pool ID. target: Optional NSX Manager target name from config. Uses default if omitted. """ from vmware_nsx.ops.networking import get_ip_pool_usage as _get_usage client = _get_connection(target) return _get_usage(client, pool_id)