whmcs_get_quotes
Retrieve and filter quotes from WHMCS by ID, client, subject, or stage to manage billing proposals.
Instructions
Get list of quotes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limitstart | No | Starting offset | |
| limitnum | No | Number of results | |
| quoteid | No | Specific quote ID | |
| userid | No | Filter by client ID | |
| subject | No | Filter by subject | |
| stage | No | Filter by stage |
Implementation Reference
- src/index.ts:1206-1226 (registration)Registration of the whmcs_get_quotes MCP tool, including title, description, Zod input schema for pagination and filtering parameters, and thin async handler that calls whmcsClient.getQuotes and returns JSON-formatted response.server.registerTool( 'whmcs_get_quotes', { title: 'Get Quotes', description: 'Get list of quotes', inputSchema: { limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), quoteid: z.number().optional().describe('Specific quote ID'), userid: z.number().optional().describe('Filter by client ID'), subject: z.string().optional().describe('Filter by subject'), stage: z.string().optional().describe('Filter by stage'), }, }, async (params) => { const result = await whmcsClient.getQuotes(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/whmcs-client.ts:1408-1440 (handler)Core handler implementation in WhmcsApiClient.getQuotes: constructs API request to WHMCS 'GetQuotes' action with filtering/pagination params and returns typed response containing list of quotes with details like ID, subject, stage, client info, dates, and total.async getQuotes(params: { limitstart?: number; limitnum?: number; quoteid?: number; userid?: number; subject?: string; stage?: string; datecreated?: string; lastmodified?: string; validuntil?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; startnumber: number; numreturned: number; quotes: { quote: Array<{ id: number; subject: string; stage: string; validuntil: string; userid: number; firstname: string; lastname: string; companyname: string; email: string; datecreated: string; lastmodified: string; datesent: string; dateaccepted: string; total: string; }> }; }>('GetQuotes', params); }
- src/index.ts:1211-1218 (schema)Zod schema defining optional input parameters for the tool: pagination (limitstart, limitnum), specific quote (quoteid), client filter (userid), and quote filters (subject, stage). Matches parameters accepted by the underlying API call.inputSchema: { limitstart: z.number().optional().describe('Starting offset'), limitnum: z.number().optional().describe('Number of results'), quoteid: z.number().optional().describe('Specific quote ID'), userid: z.number().optional().describe('Filter by client ID'), subject: z.string().optional().describe('Filter by subject'), stage: z.string().optional().describe('Filter by stage'), },
- src/whmcs-client.ts:29-63 (helper)Generic helper method WhmcsApiClient.call that performs authenticated POST requests to WHMCS API endpoint, flattens parameters, handles JSON response, and throws errors on failure. Used by getQuotes to execute the 'GetQuotes' action.async call<T extends WhmcsApiResponse>(action: string, params: Record<string, unknown> = {}): Promise<T> { const url = `${this.config.apiUrl.replace(/\/$/, '')}/includes/api.php`; const postData: Record<string, string> = { identifier: this.config.apiIdentifier, secret: this.config.apiSecret, action: action, responsetype: 'json', ...this.flattenParams(params) }; if (this.config.accessKey) { postData.accesskey = this.config.accessKey; } const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams(postData).toString(), }); if (!response.ok) { throw new Error(`WHMCS API request failed: ${response.status} ${response.statusText}`); } const data = await response.json() as T; if (data.result === 'error') { throw new Error(`WHMCS API error: ${data.message || 'Unknown error'}`); } return data; }