whm_dns_list_zones
Retrieves all DNS zones for a specified WHM account, providing a complete list of managed zones.
Instructions
List all DNS zones managed by this WHM server
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) |
Implementation Reference
- src/tools.py:198-206 (registration)Tool definition/registration for whm_dns_list_zones, defined alongside other WHM tools in the whm_tools() function.
Tool( name="whm_dns_list_zones", description="List all DNS zones managed by this WHM server", inputSchema={ "type": "object", "properties": ACCOUNT_PARAM, "required": ["account"] } ), - src/tools.py:476-477 (handler)Handler for whm_dns_list_zones: makes a GET request to WHM JSON-API 'listzones' endpoint with the account's authentication headers.
case "whm_dns_list_zones": return await _get(client, url("listzones"), headers) - src/tools.py:25-31 (helper)Helper that builds the Authorization header using the WHM token from the account config.
def _headers(account: dict) -> dict: token = account["token"] user = account.get("user", "root") return { "Authorization": f"whm {user}:{token}", "Content-Type": "application/json" } - src/tools.py:34-40 (helper)Generic async HTTP GET helper used by all WHM tool handlers, including whm_dns_list_zones.
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/tools.py:10-14 (helper)Helper that constructs the WHM JSON-API URL for a given function name (e.g., 'listzones').
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"