whmcs_update_domain_lock_status
Lock or unlock domains in WHMCS by updating domain lock status to control transfers and modifications.
Instructions
Lock or unlock a domain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domainid | Yes | Domain ID | |
| lockstatus | No | Lock status (true to lock) |
Implementation Reference
- src/index.ts:714-728 (registration)Registration of the MCP tool 'whmcs_update_domain_lock_status', including title, description, input schema (domainid and optional lockstatus), and thin async handler that calls whmcsClient.updateDomainLockingStatus and formats the response.'whmcs_update_domain_lock_status', { title: 'Update Domain Lock Status', description: 'Lock or unlock a domain', inputSchema: { domainid: z.number().describe('Domain ID'), lockstatus: z.boolean().optional().describe('Lock status (true to lock)'), }, }, async (params) => { const result = await whmcsClient.updateDomainLockingStatus(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/whmcs-client.ts:882-887 (handler)Core implementation of the domain lock status update: calls the WHMCS API action 'DomainUpdateLockingStatus' with the provided domainid and optional lockstatus parameters using the generic API call method.async updateDomainLockingStatus(params: { domainid: number; lockstatus?: boolean; }) { return this.call<WhmcsApiResponse>('DomainUpdateLockingStatus', params); }
- src/index.ts:718-721 (schema)Zod input schema validation for the tool: requires domainid (number), optional lockstatus (boolean).inputSchema: { domainid: z.number().describe('Domain ID'), lockstatus: z.boolean().optional().describe('Lock status (true to lock)'), },
- src/whmcs-client.ts:29-63 (helper)Generic call method in WhmcsApiClient that handles all WHMCS API requests, including authentication, parameter flattening, and HTTP POST to the API endpoint. Used by updateDomainLockingStatus.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; }