Skip to main content
Glama

whmcs_get_promotions

Retrieve promotion and coupon details from WHMCS to manage discounts and offers for your hosting business.

Instructions

Get list of promotions/coupons

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoSpecific promotion code

Implementation Reference

  • The core handler function getPromotions in WhmcsApiClient that executes the WHMCS API call to 'GetPromotions' action, retrieving list of promotions/coupons with optional code filter.
        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);
    }
  • src/index.ts:1185-1200 (registration)
    Registers the whmcs_get_promotions tool with the MCP server, defines the input schema using Zod, and provides a thin async handler that delegates to WhmcsApiClient.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) }],
            };
        }
    );
  • Input schema definition for the tool using Zod schema for optional 'code' parameter.
    {
        title: 'Get Promotions',
        description: 'Get list of promotions/coupons',
        inputSchema: {
            code: z.string().optional().describe('Specific promotion code'),
        },
    },

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

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