whm_list_ips
List all IP addresses on the server along with their account assignments to manage IP allocation.
Instructions
List all IP addresses on the server and their assignments
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) |
Implementation Reference
- src/tools.py:190-196 (registration)Tool registration: defines the whm_list_ips tool with name, description, and inputSchema requiring an 'account' parameter.
name="whm_list_ips", description="List all IP addresses on the server and their assignments", inputSchema={ "type": "object", "properties": ACCOUNT_PARAM, "required": ["account"] } - src/tools.py:473-474 (handler)Handler: dispatches whm_list_ips by making a GET request to the WHM 'listips' JSON API endpoint.
case "whm_list_ips": return await _get(client, url("listips"), headers) - src/tools.py:10-14 (helper)Helper: constructs the WHM API URL for a given function (e.g., 'listips').
def _whm_url(account: dict, function: str) -> str: host = account["host"] port = account.get("port", 2087) user = account.get("user", "root") return f"https://{host}:{port}/json-api/{function}?api.version=1" - src/tools.py:34-40 (helper)Helper: async HTTP GET wrapper used by all WHM tool handlers.
async def _get(client: httpx.AsyncClient, url: str, headers: dict, params: dict = None) -> dict: try: r = await client.get(url, headers=headers, params=params or {}) r.raise_for_status() return r.json() except Exception as e: return {"error": str(e)} - src/server.py:57-75 (registration)Registration: the call_tool handler in server.py routes tools prefixed with 'whm_' to handle_whm_tool, which includes whm_list_ips.
return [TextContent(type="text", text=json.dumps(result, indent=2))] account_alias = arguments.get("account") if not account_alias: return [TextContent(type="text", text="ERROR: 'account' parameter is required. Use list_accounts to see available accounts.")] account = get_account(account_alias) if not account: return [TextContent(type="text", text=f"ERROR: Account '{account_alias}' not found. Use list_accounts to see configured accounts.")] async with httpx.AsyncClient(verify=False, timeout=30) as client: if name.startswith("whm_"): result = await handle_whm_tool(client, account, name, arguments) elif name.startswith("cpanel_"): result = await handle_cpanel_tool(client, account, name, arguments) else: result = {"error": f"Unknown tool: {name}"} return [TextContent(type="text", text=json.dumps(result, indent=2))]