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
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Specific promotion code |
Implementation Reference
- src/whmcs-client.ts:1372-1399 (handler)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) }], }; } );
- src/index.ts:1187-1193 (schema)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'), }, },