whmcs_get_clients
Retrieve client lists from WHMCS with filtering, sorting, and pagination options for efficient management.
Instructions
Get a list of clients from WHMCS with optional filtering and pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limitstart | No | Starting offset for results (default 0) | |
| limitnum | No | Number of results to return (default 25) | |
| sorting | No | Sort order | |
| status | No | Filter by status (Active, Inactive, Closed) | |
| search | No | Search term to filter clients | |
| orderby | No | Field to order by |
Implementation Reference
- src/index.ts:63-68 (handler)Handler function that executes the tool: calls whmcsClient.getClients(params) and returns formatted JSON response.async (params) => { const result = await whmcsClient.getClients(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:54-61 (schema)Input schema using Zod for tool parameters: pagination, sorting, filtering by status/search/order.inputSchema: { limitstart: z.number().optional().describe('Starting offset for results (default 0)'), limitnum: z.number().optional().describe('Number of results to return (default 25)'), sorting: z.enum(['ASC', 'DESC']).optional().describe('Sort order'), status: z.string().optional().describe('Filter by status (Active, Inactive, Closed)'), search: z.string().optional().describe('Search term to filter clients'), orderby: z.string().optional().describe('Field to order by'), },
- src/index.ts:49-69 (registration)MCP tool registration via server.registerTool including name, metadata, schema, and handler.server.registerTool( 'whmcs_get_clients', { title: 'Get Clients', description: 'Get a list of clients from WHMCS with optional filtering and pagination', inputSchema: { limitstart: z.number().optional().describe('Starting offset for results (default 0)'), limitnum: z.number().optional().describe('Number of results to return (default 25)'), sorting: z.enum(['ASC', 'DESC']).optional().describe('Sort order'), status: z.string().optional().describe('Filter by status (Active, Inactive, Closed)'), search: z.string().optional().describe('Search term to filter clients'), orderby: z.string().optional().describe('Field to order by'), }, }, async (params) => { const result = await whmcsClient.getClients(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/whmcs-client.ts:101-124 (helper)WhmcsApiClient.getClients method: performs the actual WHMCS 'GetClients' API call via this.call and type-defines response.async getClients(params: { limitstart?: number; limitnum?: number; sorting?: 'ASC' | 'DESC'; status?: string; search?: string; orderby?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; startnumber: number; numreturned: number; clients: { client: Array<{ id: number; firstname: string; lastname: string; companyname: string; email: string; datecreated: string; groupid: number; status: string; }> }; }>('GetClients', params); }