Skip to main content
Glama

whmcs_get_orders

Retrieve WHMCS orders with filtering options for client ID, status, or specific order ID to manage billing data.

Instructions

Get orders with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitstartNoStarting offset
limitnumNoNumber of results
idNoSpecific order ID
useridNoFilter by client ID
statusNoFilter by status

Implementation Reference

  • src/index.ts:752-771 (registration)
    Registers the 'whmcs_get_orders' tool with the MCP server, defining its title, description, input schema using Zod, and a thin handler that delegates to WhmcsApiClient.getOrders
    server.registerTool( 'whmcs_get_orders', { title: 'Get Orders', description: 'Get orders with optional filtering', inputSchema: { limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), id: z.number().optional().describe('Specific order ID'), userid: z.number().optional().describe('Filter by client ID'), status: z.string().optional().describe('Filter by status'), }, }, async (params) => { const result = await whmcsClient.getOrders(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
  • Core handler implementation for whmcs_get_orders: the getOrders method in WhmcsApiClient that makes the WHMCS API call to 'GetOrders' action with parameters and returns the typed response containing order details
    /** * Get orders */ async getOrders(params: { limitstart?: number; limitnum?: number; id?: number; userid?: number; status?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; startnumber: number; numreturned: number; orders: { order: Array<{ id: number; ordernum: string; userid: number; contactid: number; requestor_id: number; date: string; nameservers: string; transfersecret: string; renewals: string; promocode: string; promotype: string; promovalue: string; orderdata: string; amount: string; paymentmethod: string; invoiceid: number; status: string; ipaddress: string; fraudmodule: string; fraudoutput: string; notes: string; paymentmethodname: string; paymentstatus: string; lineitems: { lineitem: Array<{ type: string; relid: number; producttype: string; product: string; domain: string; billingcycle: string; amount: string; status: string; }> }; }> }; }>('GetOrders', params); }
  • Zod input schema definition for the whmcs_get_orders tool parameters
    inputSchema: { limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), id: z.number().optional().describe('Specific order ID'), userid: z.number().optional().describe('Filter by client ID'), status: z.string().optional().describe('Filter by status'), },
  • Generic WHMCS API client method used by getOrders to perform 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; }

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