Skip to main content
Glama

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
NameRequiredDescriptionDefault
domainidYesDomain 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.getDomainWhoisInfo
    server.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) }],
            };
        }
    );
  • 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);
    }
  • Base response type WhmcsApiResponse used for all API responses including DomainWhois
    export interface WhmcsApiResponse {
        result: 'success' | 'error';
        message?: string;
        [key: string]: unknown;
    }
  • Type definition for DomainWhois response including structured WHOIS data
        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);
    }
  • The generic call method used by all API methods including getDomainWhoisInfo to make HTTP requests to WHMCS API
    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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scarecr0w12/whmcs-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server