Skip to main content
Glama

Update Invoice

whmcs_update_invoice

Update an existing invoice's status, payment method, dates, or notes to maintain accurate billing records.

Instructions

Update an existing invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceidYesInvoice ID to update
statusNoNew status
paymentmethodNoPayment method
dateNoInvoice date (YYYY-MM-DD)
duedateNoDue date (YYYY-MM-DD)
notesNoInvoice notes
publishNoPublish draft invoice
publishandsendemailNoPublish and send email

Implementation Reference

  • src/index.ts:325-347 (registration)
    Registration of the 'whmcs_update_invoice' tool with MCP server. Defines the tool name, input schema (invoiceid required; optional: status, paymentmethod, date, duedate, notes, publish, publishandsendemail), and the handler that delegates to whmcsClient.updateInvoice().
    server.registerTool(
        'whmcs_update_invoice',
        {
            title: 'Update Invoice',
            description: 'Update an existing invoice',
            inputSchema: {
                invoiceid: z.number().describe('Invoice ID to update'),
                status: z.enum(['Draft', 'Unpaid', 'Paid', 'Cancelled', 'Refunded', 'Collections']).optional().describe('New status'),
                paymentmethod: z.string().optional().describe('Payment method'),
                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'),
                publish: z.boolean().optional().describe('Publish draft invoice'),
                publishandsendemail: z.boolean().optional().describe('Publish and send email'),
            },
        },
        async (params) => {
            const result = await whmcsClient.updateInvoice(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • The inline handler function for 'whmcs_update_invoice'. It calls whmcsClient.updateInvoice(params) and returns the JSON-stringified result.
    async (params) => {
        const result = await whmcsClient.updateInvoice(params);
        return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        };
    }
  • Input schema (Zod) for whmcs_update_invoice: invoiceid (required number), and optional fields: status (enum Draft/Unpaid/Paid/Cancelled/Refunded/Collections), paymentmethod, date, duedate, notes, publish, publishandsendemail.
        inputSchema: {
            invoiceid: z.number().describe('Invoice ID to update'),
            status: z.enum(['Draft', 'Unpaid', 'Paid', 'Cancelled', 'Refunded', 'Collections']).optional().describe('New status'),
            paymentmethod: z.string().optional().describe('Payment method'),
            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'),
            publish: z.boolean().optional().describe('Publish draft invoice'),
            publishandsendemail: z.boolean().optional().describe('Publish and send email'),
        },
    },
  • The updateInvoice() method on WhmcsApiClient. Maps the tool's parameters to the WHMCS API 'UpdateInvoice' action. Accepts all invoice fields including invoiceid, status, paymentmethod, taxrate, date, duedate, notes, item arrays, deletelineids, publish, and publishandsendemail.
     * Update an invoice
     */
    async updateInvoice(params: {
        invoiceid: number;
        status?: 'Draft' | 'Unpaid' | 'Paid' | 'Cancelled' | 'Refunded' | 'Collections';
        paymentmethod?: string;
        taxrate?: number;
        taxrate2?: number;
        date?: string;
        duedate?: string;
        datepaid?: string;
        notes?: string;
        itemdescription?: string[];
        itemamount?: number[];
        itemtaxed?: boolean[];
        newitemdescription?: string[];
        newitemamount?: number[];
        newitemtaxed?: boolean[];
        deletelineids?: number[];
        publish?: boolean;
        publishandsendemail?: boolean;
    }) {
        return this.call<WhmcsApiResponse & { invoiceid: number }>('UpdateInvoice', params);
    }
Behavior2/5

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

No annotations are provided, and the description only says 'update', lacking details on side effects, permissions, or constraints like whether an invoice can be updated after being paid.

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

Conciseness3/5

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

The description is a single sentence, which is concise, but it is too short to be fully informative; it sacrifices completeness for brevity.

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?

For an update tool with 8 parameters and no output schema, the description lacks information on effects, order, allowed transitions, and prerequisites, making it incomplete.

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%, and the description adds no additional meaning beyond what the input schema already provides for each parameter.

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

Purpose3/5

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

The description clearly states the tool updates an invoice, but it is generic and does not distinguish from sibling tools like whmcs_create_invoice or whmcs_get_invoice.

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?

No guidance is provided on when to use this tool versus alternatives, nor any prerequisites or context for updating invoices.

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