Skip to main content
Glama

Get Email Templates

whmcs_get_email_templates

Retrieve a list of email templates from WHMCS, filtered by template type and language.

Instructions

Get list of email templates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoTemplate type
languageNoTemplate 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) }],
            };
        }
    );
  • 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'),
        },
    },
  • 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);
    }
  • 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);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must bear the full burden of behavioral disclosure. It only states 'Get list' without mentioning side effects (none expected), authentication needs, pagination, or the structure of the returned list. This lack of detail leaves the agent with insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, straightforward sentence with no redundancy. It efficiently conveys the core purpose without unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of an output schema, the description should clarify what elements are included in the email template list (e.g., name, subject, body?). It does not. However, for a simple list retrieval tool, the description is minimally adequate but leaves important details unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters ('type' and 'language') are documented with descriptions. The tool description adds no further meaning; it just restates the resource obtained. Minimal value added beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and resource ('list of email templates'), clearly identifying the tool's function. While it does not explicitly differentiate from siblings, the sibling tools mostly target different resources (e.g., invoices, clients), so confusion is unlikely.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There is no mention of use cases, prerequisites, or relationship to related tools like whmcs_send_email. The agent must infer context from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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