Skip to main content
Glama

Get Invoices

whmcs_get_invoices

Retrieve WHMCS invoices filtered by client ID, status, or date, with pagination and sorting options.

Instructions

Get invoices with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitstartNoStarting offset
limitnumNoNumber of results
useridNoFilter by client ID
statusNoFilter by status
orderbyNoField to order by
orderNoSort order

Implementation Reference

  • src/index.ts:258-278 (registration)
    Registration of the whmcs_get_invoices tool on the MCP server, with schema definition for input parameters (limitstart, limitnum, userid, status, orderby, order). The handler delegates to whmcsClient.getInvoices().
    server.registerTool(
        'whmcs_get_invoices',
        {
            title: 'Get Invoices',
            description: 'Get invoices with optional filtering',
            inputSchema: {
                limitstart: z.number().optional().describe('Starting offset'),
                limitnum: z.number().optional().describe('Number of results'),
                userid: z.number().optional().describe('Filter by client ID'),
                status: z.enum(['Paid', 'Unpaid', 'Cancelled', 'Refunded', 'Collections', 'Draft', 'Overdue']).optional().describe('Filter by status'),
                orderby: z.string().optional().describe('Field to order by'),
                order: z.enum(['asc', 'desc']).optional().describe('Sort order'),
            },
        },
        async (params) => {
            const result = await whmcsClient.getInvoices(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • The getInvoices method on WhmcsApiClient that actually calls the WHMCS API with action 'GetInvoices'. It defines the full response type including invoice fields (id, userid, date, duedate, total, status, paymentmethod, etc.).
    async getInvoices(params: {
        limitstart?: number;
        limitnum?: number;
        userid?: number;
        status?: 'Paid' | 'Unpaid' | 'Cancelled' | 'Refunded' | 'Collections' | 'Draft' | 'Overdue';
        orderby?: string;
        order?: 'asc' | 'desc';
    } = {}) {
        return this.call<WhmcsApiResponse & {
            totalresults: number;
            startnumber: number;
            numreturned: number;
            invoices: { invoice: Array<{
                id: number;
                userid: number;
                firstname: string;
                lastname: string;
                companyname: string;
                invoicenum: string;
                date: string;
                duedate: string;
                datepaid: string;
                last_capture_attempt: string;
                subtotal: string;
                credit: string;
                tax: string;
                tax2: string;
                total: string;
                taxrate: string;
                taxrate2: string;
                status: string;
                paymentmethod: string;
                paymethodid: string | null;
                notes: string;
                currencycode: string;
                currencyprefix: string;
                currencysuffix: string;
            }> };
        }>('GetInvoices', params);
    }
  • Zod schema for the get_invoices tool input validation, defining optional filtering parameters with enums for status and sort order.
    inputSchema: {
        limitstart: z.number().optional().describe('Starting offset'),
        limitnum: z.number().optional().describe('Number of results'),
        userid: z.number().optional().describe('Filter by client ID'),
        status: z.enum(['Paid', 'Unpaid', 'Cancelled', 'Refunded', 'Collections', 'Draft', 'Overdue']).optional().describe('Filter by status'),
        orderby: z.string().optional().describe('Field to order by'),
        order: z.enum(['asc', 'desc']).optional().describe('Sort order'),
    },
Behavior2/5

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

No annotations are present, so the description must disclose behaviors. It only says 'Get invoices', implying a read operation, but does not confirm non-destructiveness, authentication needs, rate limits, or pagination behavior. The filtering parameters are mentioned but not explained beyond the schema.

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 single-sentence description is concise and front-loaded. It wastes no words and is easy to parse. However, it could be slightly more informative without losing conciseness.

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

Completeness2/5

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

With no output schema and 6 optional parameters, the description lacks completeness. It does not explain the return format, pagination (despite limitstart/limitnum), or that it returns a list of invoices. An agent cannot infer the full behavior from this minimal description.

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

Parameters3/5

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

The input schema has 100% coverage with descriptions for all 6 parameters (e.g., 'Starting offset', 'Filter by client ID'). The description adds no extra meaning beyond 'optional filtering', which is already evident. Baseline 3 is appropriate.

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

Purpose4/5

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

The description 'Get invoices with optional filtering' clearly states the verb 'Get' and the resource 'invoices', indicating a list retrieval. The term 'optional filtering' hints at the filtering parameters. It distinguishes from the sibling 'whmcs_get_invoice' (singular) by implying multiple invoices, but could be more explicit (e.g., 'list all invoices').

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 usage guidelines are provided. The description does not specify when to use this tool over alternatives like 'whmcs_get_invoice' for a single invoice or 'whmcs_get_orders' for related records. There is no mention of prerequisites or context.

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