whmcs_get_client_products
Retrieve products and services owned by a WHMCS client using filters like client ID, domain, or product ID.
Instructions
Get products/services owned by a client
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientid | No | The client ID | |
| serviceid | No | Specific service ID | |
| domain | No | Filter by domain | |
| pid | No | Filter by product ID | |
| limitstart | No | Starting offset | |
| limitnum | No | Number of results |
Implementation Reference
- src/index.ts:188-192 (handler)The async handler function registered for the tool. It invokes whmcsClient.getClientProducts with input params and returns the JSON-formatted result as MCP content.const result = await whmcsClient.getClientProducts(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:179-185 (schema)Zod-based input schema defining optional parameters for filtering and pagination when retrieving client products.clientid: z.number().optional().describe('The client ID'), serviceid: z.number().optional().describe('Specific service ID'), domain: z.string().optional().describe('Filter by domain'), pid: z.number().optional().describe('Filter by product ID'), limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), },
- src/index.ts:174-194 (registration)Full registration of the 'whmcs_get_client_products' MCP tool using McpServer.registerTool method, including title, description, input schema, and handler.'whmcs_get_client_products', { title: 'Get Client Products', description: 'Get products/services owned by a client', inputSchema: { clientid: z.number().optional().describe('The client ID'), serviceid: z.number().optional().describe('Specific service ID'), domain: z.string().optional().describe('Filter by domain'), pid: z.number().optional().describe('Filter by product ID'), limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), }, }, async (params) => { const result = await whmcsClient.getClientProducts(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/whmcs-client.ts:246-300 (helper)WhmcsApiClient.getClientProducts helper method that performs the actual WHMCS API call to action 'GetClientsProducts' with typed response handling and parameter flattening.async getClientProducts(params: { clientid?: number; serviceid?: number; domain?: string; pid?: number; username2?: string; limitstart?: number; limitnum?: number; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; startnumber: number; numreturned: number; products: { product: Array<{ id: number; clientid: number; orderid: number; pid: number; regdate: string; name: string; translated_name: string; groupname: string; translated_groupname: string; domain: string; dedicatedip: string; serverid: number; servername: string; serverip: string; serverhostname: string; suspensionreason: string; firstpaymentamount: string; recurringamount: string; paymentmethod: string; paymentmethodname: string; billingcycle: string; nextduedate: string; status: string; username: string; password: string; subscriptionid: string; promoid: number; overideautosuspend: string; overidesuspenduntil: string; ns1: string; ns2: string; assignedips: string; notes: string; diskusage: number; disklimit: number; bwusage: number; bwlimit: number; lastupdate: string; }> }; }>('GetClientsProducts', params); }