addVouchers
Create discount codes and gift certificates in the Mews hospitality platform to manage promotional offers and customer incentives.
Instructions
Adds new vouchers (discount codes, gift certificates) to the system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Vouchers | Yes | Array of voucher objects to create |
Implementation Reference
- src/tools/vouchers/addVouchers.ts:41-54 (handler)The asynchronous execute function implementing the core logic of the addVouchers tool. It constructs the request data from input arguments and calls the mewsRequest utility to POST to the '/api/connector/v1/vouchers/add' endpoint.async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const inputArgs = args as Record<string, unknown>; const requestData = { ...inputArgs }; const result = await mewsRequest(config, '/api/connector/v1/vouchers/add', requestData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- The inputSchema defining the expected input structure for the addVouchers tool, specifying an array of Vouchers with required fields Name and Code, and optional fields like Value, validity dates, usage limits, etc.inputSchema: { type: 'object', properties: { Vouchers: { type: 'array', items: { type: 'object', properties: { Name: { type: 'string', description: 'Voucher name' }, Code: { type: 'string', description: 'Voucher code' }, Value: { type: 'object', properties: { Currency: { type: 'string', description: 'Voucher currency' }, Amount: { type: 'number', description: 'Voucher amount' } }, description: 'Voucher value' }, ValidityStartUtc: { type: 'string', description: 'Voucher validity start (ISO 8601)' }, ValidityEndUtc: { type: 'string', description: 'Voucher validity end (ISO 8601)' }, UsageLimit: { type: 'number', description: 'Maximum number of uses' }, Type: { type: 'string', description: 'Voucher type' }, AccountingCategoryId: { type: 'string', description: 'Accounting category for voucher' } }, required: ['Name', 'Code'] }, description: 'Array of voucher objects to create' } }, required: ['Vouchers'], additionalProperties: false },
- src/tools/index.ts:66-66 (registration)Import statement bringing the addVouchersTool into the central index file.import { addVouchersTool } from './vouchers/addVouchers.js';
- src/tools/index.ts:150-152 (registration)The addVouchersTool is added to the allTools array, which collects and exports all available tools for registration and execution.// Voucher tools addVouchersTool,