whmcs_get_domain_whois
Retrieve WHOIS information for a domain using its domain ID from a WHMCS installation.
Instructions
Get WHOIS information for a domain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domainid | Yes | Domain ID |
Implementation Reference
- src/index.ts:640-655 (registration)Registration of the MCP tool 'whmcs_get_domain_whois' including input schema and handler function that calls WhmcsApiClient.getDomainWhoisInfoserver.registerTool( 'whmcs_get_domain_whois', { title: 'Get Domain WHOIS', description: 'Get WHOIS information for a domain', inputSchema: { domainid: z.number().describe('Domain ID'), }, }, async (params) => { const result = await whmcsClient.getDomainWhoisInfo(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/whmcs-client.ts:838-851 (handler)Core handler function getDomainWhoisInfo in WhmcsApiClient that performs the actual WHMCS API call to 'DomainWhois' for the specified domain ID* Get domain WHOIS info */ async getDomainWhoisInfo(params: { domainid: number }) { return this.call<WhmcsApiResponse & { status: string; domain: { registrant: Record<string, string>; admin: Record<string, string>; tech: Record<string, string>; billing: Record<string, string>; }; }>('DomainWhois', params); }
- src/whmcs-client.ts:13-17 (schema)Base response type WhmcsApiResponse used for all API responses including DomainWhoisexport interface WhmcsApiResponse { result: 'success' | 'error'; message?: string; [key: string]: unknown; }
- src/whmcs-client.ts:841-851 (schema)Type definition for DomainWhois response including structured WHOIS datareturn this.call<WhmcsApiResponse & { status: string; domain: { registrant: Record<string, string>; admin: Record<string, string>; tech: Record<string, string>; billing: Record<string, string>; }; }>('DomainWhois', params); }
- src/whmcs-client.ts:29-63 (helper)The generic call method used by all API methods including getDomainWhoisInfo to make HTTP requests to WHMCS APIasync 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; }