whmcs_get_currencies
Retrieve configured currencies from a WHMCS installation to manage billing and payment settings.
Instructions
Get configured currencies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1029-1041 (registration)MCP tool registration for whmcs_get_currencies, including schema (empty input) and thin wrapper handler calling whmcsClient.getCurrencies()'whmcs_get_currencies', { title: 'Get Currencies', description: 'Get configured currencies', inputSchema: {}, }, async () => { const result = await whmcsClient.getCurrencies(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/whmcs-client.ts:1219-1232 (handler)Core handler implementation in WhmcsApiClient that performs the actual WHMCS API call to 'GetCurrencies' actionasync getCurrencies() { return this.call<WhmcsApiResponse & { totalresults: number; currencies: { currency: Array<{ id: number; code: string; prefix: string; suffix: string; format: number; rate: string; default: number; }> }; }>('GetCurrencies'); }
- src/whmcs-client.ts:29-63 (helper)Generic API call helper method used by all WHMCS API methods, including getCurrencies, handling authentication, request formatting, and error handlingasync 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; }