addLoyaltyMemberships
Create new loyalty memberships in the Mews hospitality system to manage customer reward programs and track points.
Instructions
Adds new loyalty memberships to the system
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"LoyaltyMemberships": "<LoyaltyMemberships>"
},
"name": "addLoyaltyMemberships"
}
}Input 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 execute handler function sends the input arguments to the Mews API endpoint '/api/connector/v1/loyaltyMemberships/add' via mewsRequest utility and returns the formatted JSON response.
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) }] }; } - Input schema defining the structure for ChainId (optional) and LoyaltyMemberships array (required, up to 1000 items), each with required AccountId and LoyaltyProgramId, and optional other properties.
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:157-159 (registration)Registers the addLoyaltyMembershipsTool in the central allTools array exported for use in the MCP server.
// Loyalty tools getAllLoyaltyMembershipsTool, addLoyaltyMembershipsTool, - src/tools/index.ts:74-74 (registration)Imports the addLoyaltyMembershipsTool from its implementation file.
import { addLoyaltyMembershipsTool } from './loyalty/addLoyaltyMemberships.js';