cpanel_email_list
List all email accounts for a cPanel user's domain.
Instructions
List all email accounts for a cPanel user's domain
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) | |
| cpanel_user | Yes | cPanel username | |
| domain | Yes | Domain to list emails for |
Implementation Reference
- src/server.py:42-43 (registration)The tool 'cpanel_email_list' is registered via cpanel_tools() which is called in list_tools() on line 43, adding all cPanel tool definitions to the server.
all_tools.extend(whm_tools()) all_tools.extend(cpanel_tools()) - src/tools.py:43-47 (registration)The call_tool() handler routes tools starting with 'cpanel_' to handle_cpanel_tool() on line 71.
async def _post(client: httpx.AsyncClient, url: str, headers: dict, data: dict = None) -> dict: try: r = await client.post(url, headers=headers, json=data or {}) r.raise_for_status() return r.json() - src/tools.py:286-298 (schema)Tool definition for 'cpanel_email_list' with inputSchema requiring 'account', 'cpanel_user', and 'domain'.
Tool( name="cpanel_email_list", description="List all email accounts for a cPanel user's domain", inputSchema={ "type": "object", "properties": { **ACCOUNT_PARAM, "cpanel_user": {"type": "string", "description": "cPanel username"}, "domain": {"type": "string", "description": "Domain to list emails for"} }, "required": ["account", "cpanel_user", "domain"] } ), - src/tools.py:525-526 (handler)Handler for 'cpanel_email_list': calls cPanel UAPI 'Email/list_pops' with the provided 'domain' parameter.
case "cpanel_email_list": return await _get(client, url("Email", "list_pops"), headers, {"domain": args.get("domain", "")}) - src/tools.py:17-22 (helper)Helper function _cpanel_url builds the WHM-proxied UAPI URL used by the cpanel_email_list handler to reach the cPanel API.
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"