whm_list_accounts
Retrieve a list of all cPanel accounts on your WHM server, including disk usage, domain, and account status.
Instructions
List all cPanel accounts on this WHM server with disk usage, domain, status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) |
Implementation Reference
- src/tools.py:427-428 (handler)Handler for whm_list_accounts: calls WHM JSON API 'listaccts' endpoint via HTTP GET.
case "whm_list_accounts": return await _get(client, url("listaccts"), headers) - src/tools.py:74-82 (schema)Schema definition / registration of whm_list_accounts tool with its input schema (requires 'account' param).
Tool( name="whm_list_accounts", description="List all cPanel accounts on this WHM server with disk usage, domain, status", inputSchema={ "type": "object", "properties": {**ACCOUNT_PARAM}, "required": ["account"] } ), - src/server.py:36-42 (registration)Tool registration: whm_tools() is called in the list_tools handler to register all WHM tools including whm_list_accounts.
all_tools = [] all_tools.append(Tool( name="list_accounts", description="List all configured WHM/cPanel server accounts available in this MCP", inputSchema={"type": "object", "properties": {}, "required": []} )) all_tools.extend(whm_tools()) - src/server.py:67-69 (registration)Dispatch: call_tool routes whm_ prefixed tools to handle_whm_tool which handles whm_list_accounts.
async with httpx.AsyncClient(verify=False, timeout=30) as client: if name.startswith("whm_"): result = await handle_whm_tool(client, account, name, arguments) - src/tools.py:10-15 (helper)Helper function _whm_url builds the WHM JSON API URL for a given function (e.g., 'listaccts').
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"