Skip to main content
Glama

whmcs_get_product_groups

Retrieve all product groups from WHMCS to organize and manage hosting services, billing plans, or digital products within your system.

Instructions

Get all product groups from WHMCS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:239-252 (registration)
    Registers the 'whmcs_get_product_groups' tool with the MCP server. Defines empty input schema and a thin handler wrapper that calls whmcsClient.getProductGroups() and returns JSON response.
    server.registerTool( 'whmcs_get_product_groups', { title: 'Get Product Groups', description: 'Get all product groups from WHMCS', inputSchema: {}, }, async () => { const result = await whmcsClient.getProductGroups(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
  • Core handler implementation in WhmcsApiClient class. Makes authenticated API call to WHMCS 'GetProductGroups' action, handling response typing for product groups data.
    async getProductGroups() { return this.call<WhmcsApiResponse & { totalresults: number; productgroups: { productgroup: Array<{ id: number; name: string; headline: string; tagline: string; orderfrmtpl: string; }> }; }>('GetProductGroups'); }
  • Input schema definition for the tool (empty object, no parameters required). Defined inline in registration.
    'whmcs_get_product_groups', { title: 'Get Product Groups', description: 'Get all product groups from WHMCS', inputSchema: {},
  • Helper method flattenParams used by all API calls including getProductGroups to properly encode nested parameters for WHMCS API.
    private flattenParams(params: Record<string, unknown>, prefix = ''): Record<string, string> { const result: Record<string, string> = {}; for (const [key, value] of Object.entries(params)) { const newKey = prefix ? `${prefix}[${key}]` : key; if (value === null || value === undefined) { continue; } else if (typeof value === 'object' && !Array.isArray(value)) { Object.assign(result, this.flattenParams(value as Record<string, unknown>, newKey)); } else if (Array.isArray(value)) { value.forEach((item, index) => { if (typeof item === 'object') { Object.assign(result, this.flattenParams(item as Record<string, unknown>, `${newKey}[${index}]`)); } else { result[`${newKey}[${index}]`] = String(item); } }); } else { result[newKey] = String(value); } } return result; }

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

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