addLoyaltyMemberships
Adds new loyalty memberships to the Mews hospitality platform, enabling integration of customer accounts with loyalty programs, including points, tiers, and expiration details.
Instructions
Adds new loyalty memberships to the system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ChainId | No | Unique identifier of the chain. Required when using Portfolio Access Tokens, ignored otherwise. | |
| LoyaltyMemberships | Yes | Array of loyalty membership objects to create |
Implementation Reference
- The handler function that executes the tool by sending a POST request to the Mews API endpoint '/api/connector/v1/loyaltyMemberships/add' and returns the result as formatted JSON.async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const result = await mewsRequest(config, '/api/connector/v1/loyaltyMemberships/add', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- The input schema defining the structure and validation for the tool's arguments, including optional ChainId and required array of LoyaltyMemberships.inputSchema: { type: 'object', properties: { ChainId: { type: 'string', description: 'Unique identifier of the chain. Required when using Portfolio Access Tokens, ignored otherwise.' }, LoyaltyMemberships: { type: 'array', items: { type: 'object', properties: { AccountId: { type: 'string', description: 'Unique identifier of the account (Customer or Company)' }, LoyaltyProgramId: { type: 'string', description: 'Unique identifier of the loyalty program' }, State: { type: 'string', description: 'State of the loyalty membership' }, IsPrimary: { type: 'boolean', description: 'Whether this is the primary loyalty membership for the account' }, Code: { type: 'string', description: 'Code of the loyalty membership' }, ProviderMembershipId: { type: 'string', description: 'Loyalty membership identifier assigned by external provider', maxLength: 100 }, Points: { type: 'number', description: 'The loyalty points the account has in this membership' }, ExpirationDate: { type: 'string', description: 'Expiration date of the loyalty membership in UTC timezone in ISO 8601 format' }, Url: { type: 'string', description: 'URL of the loyalty membership' }, LoyaltyTierId: { type: 'string', description: 'Unique identifier of the loyalty tier' } }, required: ['AccountId', 'LoyaltyProgramId'], additionalProperties: false }, description: 'Array of loyalty membership objects to create', maxItems: 1000 } }, required: ['LoyaltyMemberships'], additionalProperties: false },
- src/tools/index.ts:87-170 (registration)The tool is registered by being included in the central allTools array, which is used for tool lookup, definitions, and execution.export const allTools: Tool[] = [ // Account tools getAllAddressesTool, addAddressesTool, // Customer tools getAllCustomersTool, addCustomerTool, updateCustomersTool, deleteCustomersTool, mergeCustomersTool, // Company tools getAllCompaniesTool, addCompanyTool, updateCompaniesTool, deleteCompaniesTool, // Reservation tools getAllReservationsTool, addReservationTool, updateReservationsTool, cancelReservationsTool, // Configuration tools getConfigurationTool, getAllCountriesTool, getAllCurrenciesTool, getAllTaxEnvironmentsTool, getAllTaxationsTool, getAllLanguagesTool, getLanguageTextsTool, // Finance tools getAllBillsTool, getAllAccountingItemsTool, addAccountingItemsTool, // Payment tools addPaymentTool, chargeCreditCardTool, getAllPaymentsTool, // Services tools getAllServicesTool, getAllSpacesTool, getAllSpaceCategoriesTool, // Account Notes tools getAllAccountNotesTool, addAccountNotesTool, // Rates tools getAllRatesTool, getRatePricingTool, // Export tools exportAccountingItemsTool, exportReservationsTool, // Availability tools getAllAvailabilityBlocksTool, // Voucher tools addVouchersTool, // Task tools getAllTasksTool, addTaskTool, // Loyalty tools getAllLoyaltyMembershipsTool, addLoyaltyMembershipsTool, updateLoyaltyMembershipsTool, deleteLoyaltyMembershipsTool, getAllLoyaltyProgramsTool, addLoyaltyProgramsTool, updateLoyaltyProgramsTool, deleteLoyaltyProgramsTool, getAllLoyaltyTiersTool, addLoyaltyTiersTool, updateLoyaltyTiersTool, deleteLoyaltyTiersTool, ];
- src/tools/loyalty/addLoyaltyMemberships.ts:5-5 (registration)The tool object is defined and exported here for use in the central registry.export const addLoyaltyMembershipsTool: Tool = {