Get Email Templates
whmcs_get_email_templatesRetrieve a list of email templates from WHMCS, filtered by template type and language.
Instructions
Get list of email templates
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "whmcs_get_email_templates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Template type | |
| language | No | Template language |
Implementation Reference
- src/index.ts:1102-1119 (registration)Registration of the 'whmcs_get_email_templates' tool using server.registerTool(). It defines inputSchema with optional 'type' (enum) and 'language' (string) parameters, and calls whmcsClient.getEmailTemplates() as the handler.
server.registerTool( 'whmcs_get_email_templates', { title: 'Get Email Templates', description: 'Get list of email templates', inputSchema: { type: z.enum(['general', 'product', 'domain', 'invoice', 'support', 'affiliate']).optional().describe('Template type'), language: z.string().optional().describe('Template language'), }, }, async (params) => { const result = await whmcsClient.getEmailTemplates(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/index.ts:1105-1112 (schema)Input schema for 'whmcs_get_email_templates'. Defines optional 'type' (enum: general, product, domain, invoice, support, affiliate) and 'language' (string) parameters using Zod.
{ title: 'Get Email Templates', description: 'Get list of email templates', inputSchema: { type: z.enum(['general', 'product', 'domain', 'invoice', 'support', 'affiliate']).optional().describe('Template type'), language: z.string().optional().describe('Template language'), }, }, - src/whmcs-client.ts:1276-1290 (handler)The actual handler method 'getEmailTemplates' in the WhmcsApiClient class. Calls the WHMCS API action 'GetEmailTemplates' with optional type and language parameters, returning email template data.
*/ async getEmailTemplates(params: { type?: 'general' | 'product' | 'domain' | 'invoice' | 'support' | 'affiliate'; language?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; emailtemplates: { emailtemplate: Array<{ id: number; name: string; subject: string; custom: boolean; }> }; }>('GetEmailTemplates', params); } - src/whmcs-client.ts:1276-1290 (helper)The getEmailTemplates method relies on the generic call<T>() method (line 29) for making the API request and flattenParams() (line 68) for parameter serialization.
*/ async getEmailTemplates(params: { type?: 'general' | 'product' | 'domain' | 'invoice' | 'support' | 'affiliate'; language?: string; } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; emailtemplates: { emailtemplate: Array<{ id: number; name: string; subject: string; custom: boolean; }> }; }>('GetEmailTemplates', params); }