Skip to main content
Glama

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
NameRequiredDescriptionDefault
domainidYesDomain ID
lockstatusNoLock 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) }],
        };
    }
  • 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);
    }
  • 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)'),
    },
  • 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;
    }

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