whmcs_get_invoices
Retrieve and filter invoices from WHMCS by client ID, status, or date range to manage billing records.
Instructions
Get invoices with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limitstart | No | Starting offset | |
| limitnum | No | Number of results | |
| userid | No | Filter by client ID | |
| status | No | Filter by status | |
| orderby | No | Field to order by | |
| order | No | Sort order |
Implementation Reference
- src/whmcs-client.ts:407-449 (handler)Core handler implementation for whmcs_get_invoices tool. Makes the WHMCS API call to 'GetInvoices' with provided parameters and returns the response./** * Get invoices */ async getInvoices(params: { limitstart?: number; limitnum?: number; userid?: number; status?: 'Paid' | 'Unpaid' | 'Cancelled' | 'Refunded' | 'Collections' | 'Draft'; 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); }
- src/index.ts:258-277 (registration)Registers the MCP tool 'whmcs_get_invoices' including input schema validation using Zod and thin handler wrapper that delegates to WhmcsApiClient.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']).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) }], }; }
- src/index.ts:264-270 (schema)Input schema definition for whmcs_get_invoices tool using Zod for validation of filtering and pagination parameters.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']).optional().describe('Filter by status'), orderby: z.string().optional().describe('Field to order by'), order: z.enum(['asc', 'desc']).optional().describe('Sort order'), },