cpanel_dns_records
Retrieve DNS zone records for a domain using cPanel UAPI, enabling management of DNS settings across WHM accounts.
Instructions
Get DNS zone records for a domain via cPanel UAPI
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) | |
| cpanel_user | Yes | ||
| domain | Yes |
Implementation Reference
- src/tools.py:540-541 (handler)Handler for cpanel_dns_records: calls cPanel UAPI DNS::parse_zone with the given domain/zone to fetch DNS records.
case "cpanel_dns_records": return await _get(client, url("DNS", "parse_zone"), headers, {"zone": args["domain"]}) - src/tools.py:327-339 (registration)Tool definition/registration of cpanel_dns_records in the cpanel_tools() list with input schema (account, cpanel_user, domain).
Tool( name="cpanel_dns_records", description="Get DNS zone records for a domain via cPanel UAPI", inputSchema={ "type": "object", "properties": { **ACCOUNT_PARAM, "cpanel_user": {"type": "string"}, "domain": {"type": "string"} }, "required": ["account", "cpanel_user", "domain"] } ), - src/server.py:43-44 (registration)Registration via list_tools() in server.py: cpanel_tools() (which includes cpanel_dns_records) is registered with the MCP server.
all_tools.extend(cpanel_tools()) return all_tools - src/tools.py:334-338 (schema)Input schema fields for cpanel_dns_records: requires account (alias), cpanel_user (string), and domain (string).
"cpanel_user": {"type": "string"}, "domain": {"type": "string"} }, "required": ["account", "cpanel_user", "domain"] } - src/tools.py:17-22 (helper)Helper _cpanel_url constructs the WHM-proxied UAPI URL used by the handler to call DNS::parse_zone.
def _cpanel_url(account: dict, module: str, function: str, cpanel_user: str = None) -> str: host = account["host"] port = account.get("port", 2087) # WHM-proxied UAPI call on behalf of a cPanel user user = cpanel_user or account.get("cpanel_user", "") return f"https://{host}:{port}/json-api/cpanel?api.version=1&cpanel_jsonapi_user={user}&cpanel_jsonapi_module={module}&cpanel_jsonapi_func={function}&cpanel_jsonapi_apiversion=3"