whm_create_account
Create a new cPanel hosting account on a WHM server. Requires username, domain, password, email; optional plan.
Instructions
Create a new cPanel hosting account on the WHM server
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) | |
| username | Yes | ||
| domain | Yes | ||
| password | Yes | ||
| Yes | |||
| plan | No | Hosting plan name (optional) |
Implementation Reference
- src/tools.py:95-110 (schema)Input schema definition for whm_create_account tool — defines required fields (account, username, domain, password, email) and optional plan field.
Tool( name="whm_create_account", description="Create a new cPanel hosting account on the WHM server", inputSchema={ "type": "object", "properties": { **ACCOUNT_PARAM, "username": {"type": "string"}, "domain": {"type": "string"}, "password": {"type": "string"}, "email": {"type": "string"}, "plan": {"type": "string", "description": "Hosting plan name (optional)"} }, "required": ["account", "username", "domain", "password", "email"] } ), - src/tools.py:433-442 (handler)Handler logic for whm_create_account — maps arguments to WHM API 'createacct' parameters and sends GET request.
case "whm_create_account": params = { "username": args["username"], "domain": args["domain"], "password": args["password"], "contactemail": args["email"], } if "plan" in args: params["plan"] = args["plan"] return await _get(client, url("createacct"), headers, params) - src/server.py:42-44 (registration)Tool registration in server.py — whm_tools() (which includes whm_create_account) is registered via @app.list_tools() at line 34.
all_tools.extend(whm_tools()) all_tools.extend(cpanel_tools()) return all_tools - src/server.py:68-69 (registration)Dispatch to handle_whm_tool when a tool name starts with 'whm_' — routes the call to the handler containing whm_create_account logic.
if name.startswith("whm_"): result = await handle_whm_tool(client, account, name, arguments) - src/tools.py:10-14 (helper)Helper that builds the WHM JSON API URL — used to construct the 'createacct' endpoint URL for the create account call.
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"