Get Products
whmcs_get_productsGet a list of WHMCS products and services, with optional filters for product ID, group ID, or server module.
Instructions
Get available products/services from WHMCS
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | Specific product ID | |
| gid | No | Filter by product group ID | |
| module | No | Filter by server module |
Implementation Reference
- src/index.ts:220-237 (registration)Registration of the 'whmcs_get_products' tool with the MCP server. Defines the tool name, schema (pid, gid, module params), and the handler that delegates to whmcsClient.getProducts().
server.registerTool( 'whmcs_get_products', { title: 'Get Products', description: 'Get available products/services from WHMCS', inputSchema: { pid: z.number().optional().describe('Specific product ID'), gid: z.number().optional().describe('Filter by product group ID'), module: z.string().optional().describe('Filter by server module'), }, }, async (params) => { const result = await whmcsClient.getProducts(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/whmcs-client.ts:350-385 (handler)Actual handler implementation: getProducts() method on the WhmcsApiClient class. Calls the WHMCS API 'GetProducts' action with optional pid, gid, module params, returning typed product data with pricing info.
async getProducts(params: { pid?: number; gid?: number; module?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; startnumber: number; numreturned: number; products: { product: Array<{ pid: number; gid: number; type: string; name: string; description: string; module: string; paytype: string; pricing: Record<string, { prefix: string; suffix: string; msetupfee: string; qsetupfee: string; ssetupfee: string; asetupfee: string; bsetupfee: string; tsetupfee: string; monthly: string; quarterly: string; semiannually: string; annually: string; biennially: string; triennially: string; }>; }> }; }>('GetProducts', params); } - src/index.ts:225-228 (schema)Input schema definition for the whmcs_get_products tool, specifying optional parameters: pid (product ID), gid (group ID), and module (server module filter).
inputSchema: { pid: z.number().optional().describe('Specific product ID'), gid: z.number().optional().describe('Filter by product group ID'), module: z.string().optional().describe('Filter by server module'), - src/whmcs-client.ts:350-354 (schema)TypeScript parameter type definition for the getProducts method, matching the Zod schema.
async getProducts(params: { pid?: number; gid?: number; module?: string; } = {}) {