Skip to main content
Glama

Get System Stats

whmcs_get_stats

Retrieve WHMCS system statistics including total income and order counts to monitor business performance.

Instructions

Get WHMCS system statistics including income and order counts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:1002-1015 (registration)
    Registration of the 'whmcs_get_stats' tool with MCP server. No input parameters, calls whmcsClient.getStats() and returns JSON response.
    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) }],
            };
        }
    );
  • The getStats() method on WhmcsApiClient that executes the actual WHMCS API 'GetStats' call and returns typed system statistics (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');
    }
  • Generic API call helper that constructs the request to WHMCS's includes/api.php with authentication credentials and action parameter. Used by getStats() internally.
    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;
    }
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose any behavioral traits such as read-only nature, required permissions, or potential side effects. The agent cannot infer safety or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the action and result. Slightly better than minimal, but could add a word about system-wide scope without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and no output schema, the description minimally explains the tool's purpose. However, it lacks mention of what exact statistics are returned beyond income and order counts, and does not specify the output format or any prerequisites.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so the description does not need to explain them. Baseline is 4 as per instructions for 0-parameter tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Get' and resource 'system statistics' with examples 'income and order counts'. It clearly distinguishes from sibling tools like get_clients or get_invoices which target specific entities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives or any prerequisites. The description does not mention context or usage conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-tool'

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