whm_restart_service
Restart WHM services such as Apache, MySQL, or Exim by providing the account alias and service name.
Instructions
Restart a specific service on the WHM server (apache, mysql, exim, etc.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) | |
| service | Yes | Service name: apache, mysql, exim, ftp, cpsrvd |
Implementation Reference
- src/tools.py:249-260 (schema)Tool registration/definition for 'whm_restart_service' with input schema requiring 'account' and 'service' (apache, mysql, exim, ftp, cpsrvd) parameters.
Tool( name="whm_restart_service", description="Restart a specific service on the WHM server (apache, mysql, exim, etc.)", inputSchema={ "type": "object", "properties": { **ACCOUNT_PARAM, "service": {"type": "string", "description": "Service name: apache, mysql, exim, ftp, cpsrvd"} }, "required": ["account", "service"] } ), - src/tools.py:494-503 (handler)Handler implementation for 'whm_restart_service' — maps friendly service names (apache->httpd, etc.) to WHM API service names and calls the 'restartservice' WHM JSON API endpoint.
case "whm_restart_service": service_map = { "apache": "httpd", "mysql": "mysql", "exim": "exim", "ftp": "ftpd", "cpsrvd": "cpsrvd" } svc = service_map.get(args["service"].lower(), args["service"]) return await _get(client, url("restartservice"), headers, {"service": svc}) - src/server.py:21-22 (registration)Imports handle_whm_tool (which contains the handler) from tools module.
handle_whm_tool, handle_cpanel_tool ) - src/server.py:67-69 (registration)Registration: calls handle_whm_tool when a tool name starting with 'whm_' is invoked, routing 'whm_restart_service' to the correct handler.
async with httpx.AsyncClient(verify=False, timeout=30) as client: if name.startswith("whm_"): result = await handle_whm_tool(client, account, name, arguments) - src/server.py:42-44 (registration)Registration: whm_tools() is called to register all WHM tool definitions (including whm_restart_service) with the MCP server.
all_tools.extend(whm_tools()) all_tools.extend(cpanel_tools()) return all_tools