Skip to main content
Glama

Get Promotions

whmcs_get_promotions

Get a list of promotions or coupons from WHMCS, optionally filtered by a specific promotion code.

Instructions

Get list of promotions/coupons

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoSpecific promotion code

Implementation Reference

  • src/index.ts:1204-1219 (registration)
    Tool registration for 'whmcs_get_promotions' via server.registerTool(). Defines input schema with optional 'code' parameter and delegates to whmcsClient.getPromotions().
    server.registerTool(
        'whmcs_get_promotions',
        {
            title: 'Get Promotions',
            description: 'Get list of promotions/coupons',
            inputSchema: {
                code: z.string().optional().describe('Specific promotion code'),
            },
        },
        async (params) => {
            const result = await whmcsClient.getPromotions(params);
            return {
                content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
            };
        }
    );
  • Handler method getPromotions() in the WhmcsApiClient class. Calls the WHMCS API action 'GetPromotions' with an optional 'code' parameter and returns typed response data including promotion details like id, code, type, value, cycles, dates, usage limits, etc.
    async getPromotions(params: { code?: string } = {}) {
        return this.call<WhmcsApiResponse & {
            totalresults: number;
            promotions: { promotion: Array<{
                id: number;
                code: string;
                type: string;
                recurring: number;
                value: string;
                cycles: string;
                appliesto: string;
                requires: string;
                requiresexisting: number;
                startdate: string;
                expirationdate: string;
                maxuses: number;
                uses: number;
                lifetimepromo: number;
                applyonce: number;
                newsignups: number;
                existingclient: number;
                onceperclient: number;
                recurfor: number;
                upgrades: number;
                upgradeconfig: string;
                notes: string;
            }> };
        }>('GetPromotions', params);
    }
Behavior2/5

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

No annotations are present, and the description does not disclose behavioral traits beyond the basic read operation. It doesn't state that the tool is read-only (likely safe), whether it requires specific permissions, or any side effects. For a simple list operation, the agent may infer safety, but the description fails to confirm or add value beyond the obvious.

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 that directly states the tool's function. It is front-loaded and efficient, containing no unnecessary words. However, it could be slightly expanded to include context without harming conciseness, such as specifying the return type.

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 having only one parameter and no output schema, the description is too minimal. It does not explain what information is returned (e.g., fields like id, code, type, value) or any filtering capability beyond the optional 'code' parameter. For a listing tool, the agent would need to infer the output structure, which may lead to uncertainty.

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?

The input schema has 100% description coverage for its single parameter 'code', which is described as 'Specific promotion code'. The tool description adds no additional parameter context beyond what the schema already provides. Per guidelines, with high schema coverage, the baseline is 3, and no extra value is added.

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 'Get list of promotions/coupons' clearly states the verb (Get) and resource (promotions/coupons), making the tool's purpose immediately understandable. While it doesn't explicitly distinguish from siblings like whmcs_get_products, the specific resource 'promotions' is unique enough among the get_* tools to avoid confusion.

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 mention of when not to use it. For example, an agent would benefit from knowing whether this tool returns all promotions or only active ones, or if there's a specific scenario where a different tool should be used instead (e.g., whmcs_get_invoices for invoice-based promotions).

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