Skip to main content
Glama

whmcs_get_stats

Retrieve WHMCS system statistics such as income totals and order counts to monitor business performance and track key metrics.

Instructions

Get WHMCS system statistics including income and order counts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler method in WhmcsApiClient that performs the WHMCS API 'GetStats' call to retrieve system statistics including income, orders, tickets, etc.
    async getStats() { return this.call<WhmcsApiResponse & { income_today: string; income_thismonth: string; income_thisyear: string; income_alltime: string; orders_pending: number; orders_today_cancelled: number; orders_today_pending: number; orders_today_fraud: number; orders_today_active: number; orders_today_total: number; orders_yesterday_cancelled: number; orders_yesterday_pending: number; orders_yesterday_fraud: number; orders_yesterday_active: number; orders_yesterday_total: number; orders_thismonth_total: number; orders_thisyear_total: number; tickets_allactive: number; tickets_awaitingreply: number; tickets_flaggedtickets: number; cancellations_pending: number; todoitems_due: number; networkissues_open: number; billableitems_uninvoiced: number; quotes_valid: number; }>('GetStats'); }
  • src/index.ts:983-996 (registration)
    Registers the 'whmcs_get_stats' MCP tool, providing title, description, empty input schema (no parameters), and thin handler that invokes whmcsClient.getStats() and formats response as JSON text.
    server.registerTool( 'whmcs_get_stats', { title: 'Get System Stats', description: 'Get WHMCS system statistics including income and order counts', inputSchema: {}, }, async () => { const result = await whmcsClient.getStats(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
  • Defines the input schema for the tool as empty object (no input parameters required).
    inputSchema: {}, }, async () => { const result = await whmcsClient.getStats(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
  • General helper method used by all API methods including getStats to make authenticated POST requests to 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