whmcs_transfer_domain
Transfer a domain to another registrar by sending the command using the specified domain ID.
Instructions
Send domain transfer command to registrar
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domainid | Yes | Domain ID |
Implementation Reference
- src/whmcs-client.ts:822-826 (handler)Core handler method that executes the WHMCS API call for DomainTransfer action using the provided domain ID.async transferDomain(params: { domainid: number; }) { return this.call<WhmcsApiResponse>('DomainTransfer', params); }
- src/index.ts:607-621 (registration)Registers the 'whmcs_transfer_domain' tool with the MCP server, including input schema validation using Zod and a thin handler that delegates to WhmcsApiClient.transferDomain.'whmcs_transfer_domain', { title: 'Transfer Domain', description: 'Send domain transfer command to registrar', inputSchema: { domainid: z.number().describe('Domain ID'), }, }, async (params) => { const result = await whmcsClient.transferDomain(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/index.ts:612-614 (schema)Defines the input schema for the tool using Zod, requiring a domainid (number).domainid: z.number().describe('Domain ID'), }, },
- src/whmcs-client.ts:29-63 (helper)Generic helper method used by all API calls, including transferDomain, to make authenticated POST requests to the WHMCS API endpoint.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; }