Module Change Password
whmcs_module_change_passwordUpdates a WHMCS service account password using the service ID and new password.
Instructions
Change password for a service account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountid | Yes | Service ID | |
| servicepassword | No | New password |
Implementation Reference
- src/index.ts:980-996 (registration)Registration of the 'whmcs_module_change_password' tool with input schema (accountid required, servicepassword optional) and handler that delegates to whmcsClient.moduleChangePassword()
server.registerTool( 'whmcs_module_change_password', { title: 'Module Change Password', description: 'Change password for a service account', inputSchema: { accountid: z.number().describe('Service ID'), servicepassword: z.string().optional().describe('New password'), }, }, async (params) => { const result = await whmcsClient.moduleChangePassword(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/index.ts:985-988 (schema)Input schema for whmcs_module_change_password: accountid (number, required) and servicepassword (string, optional)
inputSchema: { accountid: z.number().describe('Service ID'), servicepassword: z.string().optional().describe('New password'), }, - src/whmcs-client.ts:1142-1147 (handler)The moduleChangePassword method on WhmcsApiClient that calls WHMCS API action 'ModuleChangePassword' with accountid and optional servicepassword parameters
async moduleChangePassword(params: { accountid: number; servicepassword?: string; }) { return this.call<WhmcsApiResponse>('ModuleChangePassword', params); } - src/whmcs-client.ts:29-63 (helper)Core API call method that handles authentication, URL construction, parameter flattening, and response parsing for all WHMCS API requests including ModuleChangePassword
async call<T extends WhmcsApiResponse>(action: string, params: Record<string, unknown> = {}): Promise<T> { const url = `${this.config.apiUrl.replace(/\/$/, '')}/includes/api.php`; const postData: Record<string, string> = { identifier: this.config.apiIdentifier, secret: this.config.apiSecret, action: action, responsetype: 'json', ...this.flattenParams(params) }; if (this.config.accessKey) { postData.accesskey = this.config.accessKey; } const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams(postData).toString(), }); if (!response.ok) { throw new Error(`WHMCS API request failed: ${response.status} ${response.statusText}`); } const data = await response.json() as T; if (data.result === 'error') { throw new Error(`WHMCS API error: ${data.message || 'Unknown error'}`); } return data; }