Skip to main content
Glama

Create Invoice

whmcs_create_invoice

Creates a new invoice for a specified client in WHMCS, allowing configuration of status, dates, payment method, and line items.

Instructions

Create a new invoice for a client

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
useridYesClient ID
statusNoInvoice status
sendinvoiceNoSend invoice email
paymentmethodNoPayment method
taxrateNoTax rate percentage
taxrate2NoSecond tax rate percentage
dateNoInvoice date (YYYY-MM-DD)
duedateNoDue date (YYYY-MM-DD)
notesNoInvoice notes
itemdescriptionNoLine item descriptions
itemamountNoLine item amounts
itemtaxedNoLine items taxed flags

Implementation Reference

  • src/index.ts:297-323 (registration)
    Tool registration for 'whmcs_create_invoice' on the MCP server. Registers the tool with Zod schema for input validation (userid required, optional: status, sendinvoice, paymentmethod, taxrate, taxrate2, date, duedate, notes, itemdescription, itemamount, itemtaxed). The handler delegates to whmcsClient.createInvoice(params).
    server.registerTool(
        'whmcs_create_invoice',
        {
            title: 'Create Invoice',
            description: 'Create a new invoice for a client',
            inputSchema: {
                userid: z.number().describe('Client ID'),
                status: z.enum(['Draft', 'Unpaid', 'Paid', 'Cancelled', 'Refunded', 'Collections']).optional().describe('Invoice status'),
                sendinvoice: z.boolean().optional().describe('Send invoice email'),
                paymentmethod: z.string().optional().describe('Payment method'),
                taxrate: z.number().optional().describe('Tax rate percentage'),
                taxrate2: z.number().optional().describe('Second tax rate percentage'),
                date: z.string().optional().describe('Invoice date (YYYY-MM-DD)'),
                duedate: z.string().optional().describe('Due date (YYYY-MM-DD)'),
                notes: z.string().optional().describe('Invoice notes'),
                itemdescription: z.array(z.string()).optional().describe('Line item descriptions'),
                itemamount: z.array(z.number()).optional().describe('Line item amounts'),
                itemtaxed: z.array(z.boolean()).optional().describe('Line items taxed flags'),
            },
        },
        async (params) => {
            const result = await whmcsClient.createInvoice(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • The 'createInvoice' method on WhmcsApiClient. The actual implementation that calls the WHMCS API via this.call() with action 'CreateInvoice', passing userid, status, paymentmethod, taxrate, dates, notes, and line item arrays (itemdescription, itemamount, itemtaxed). Returns invoiceid and status.
    /**
     * Create an invoice
     */
    async createInvoice(params: {
        userid: number;
        status?: 'Draft' | 'Unpaid' | 'Paid' | 'Cancelled' | 'Refunded' | 'Collections';
        sendinvoice?: boolean;
        paymentmethod?: string;
        taxrate?: number;
        taxrate2?: number;
        date?: string;
        duedate?: string;
        notes?: string;
        itemdescription?: string[];
        itemamount?: number[];
        itemtaxed?: boolean[];
    }) {
        return this.call<WhmcsApiResponse & {
            invoiceid: number;
            status: string;
        }>('CreateInvoice', params);
    }
  • Input schema for whmcs_create_invoice using Zod. Defines: userid (required number), status (optional enum), sendinvoice (optional boolean), paymentmethod (optional string), taxrate/taxrate2 (optional numbers), date/duedate (optional strings), notes (optional string), itemdescription (optional string array), itemamount (optional number array), itemtaxed (optional boolean array).
    'whmcs_create_invoice',
    {
        title: 'Create Invoice',
        description: 'Create a new invoice for a client',
        inputSchema: {
            userid: z.number().describe('Client ID'),
            status: z.enum(['Draft', 'Unpaid', 'Paid', 'Cancelled', 'Refunded', 'Collections']).optional().describe('Invoice status'),
            sendinvoice: z.boolean().optional().describe('Send invoice email'),
            paymentmethod: z.string().optional().describe('Payment method'),
            taxrate: z.number().optional().describe('Tax rate percentage'),
            taxrate2: z.number().optional().describe('Second tax rate percentage'),
            date: z.string().optional().describe('Invoice date (YYYY-MM-DD)'),
            duedate: z.string().optional().describe('Due date (YYYY-MM-DD)'),
            notes: z.string().optional().describe('Invoice notes'),
            itemdescription: z.array(z.string()).optional().describe('Line item descriptions'),
            itemamount: z.array(z.number()).optional().describe('Line item amounts'),
            itemtaxed: z.array(z.boolean()).optional().describe('Line items taxed flags'),
        },
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for disclosing behavioral traits. It only states the basic function without explaining side effects (e.g., does it trigger email sending? What happens on failure?). Critical behaviors like permissions or auto-actions are omitted.

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

Conciseness4/5

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

The description is a single concise sentence. It is front-loaded and waste-free. However, given the tool's complexity (12 parameters), a slightly longer description could add value without losing conciseness.

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

Completeness2/5

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

Despite 12 parameters and no output schema, the description offers no information about return values, error handling, or important constraints (e.g., required relationships between line items). The tool is non-trivial, and this minimal description leaves gaps for an AI agent.

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 description coverage is 100%, meaning the input schema already documents all parameter purposes. The description adds no extra insight beyond the schema. Baseline score of 3 is appropriate since the schema suffices, but the description could have elaborated on relationships between parameters.

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

Purpose5/5

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

The description clearly states the action ('Create') and the resource ('a new invoice for a client'). The verb-resource combination is specific and unambiguous. While sibling tools like whmcs_update_invoice exist, the name and description make the creation intent obvious.

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. It does not mention that it should be used for new invoices only, nor does it exclude scenarios like updating (handled by whmcs_update_invoice). No context on prerequisites or when not to use it.

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