addVouchers
Enables creation of new vouchers, including discount codes and gift certificates, with details like name, code, value, validity period, usage limit, and accounting category, within the Mews hospitality platform.
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 execute handler function that processes the input arguments and makes an HTTP request to the Mews API endpoint '/api/connector/v1/vouchers/add' to add vouchers, returning the result as formatted JSON.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 structure for the addVouchers tool input, requiring a 'Vouchers' array of objects with at least 'Name' and 'Code'.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 that brings the addVouchersTool into the index for registration.import { addVouchersTool } from './vouchers/addVouchers.js';
- src/tools/index.ts:150-152 (registration)Registration of addVouchersTool in the allTools array, which is used for MCP tool definitions and execution lookup.// Voucher tools addVouchersTool,