addLoyaltyTiers
Create new loyalty tiers in Mews to structure customer reward programs with defined levels, benefits, and point requirements.
Instructions
Adds new loyalty tiers to the system
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ChainId | No | Unique identifier of the chain. Required when using Portfolio Access Tokens, ignored otherwise. | |
| LoyaltyTiers | Yes | Array of loyalty tier objects to create |
Implementation Reference
- The execute function of the addLoyaltyTiersTool that performs the HTTP request to the /api/connector/v1/loyaltyTiers/add endpoint.
async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const result = await mewsRequest(config, '/api/connector/v1/loyaltyTiers/add', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } - The inputSchema defining the parameters for adding loyalty tiers, including optional ChainId and required array of LoyaltyTiers.
inputSchema: { type: 'object', properties: { ChainId: { type: 'string', description: 'Unique identifier of the chain. Required when using Portfolio Access Tokens, ignored otherwise.' }, LoyaltyTiers: { type: 'array', items: { type: 'object', properties: { LoyaltyProgramId: { type: 'string', description: 'Unique identifier of the loyalty program' }, Name: { type: 'string', description: 'Name of the loyalty tier' }, Description: { type: 'string', description: 'Description of the loyalty tier' }, Level: { type: 'number', description: 'Level of the loyalty tier (lower numbers = lower tiers)' }, MinimumPointsRequired: { type: 'number', description: 'Minimum points required to reach this tier' }, BenefitDescription: { type: 'string', description: 'Description of the benefits for this tier' }, IsActive: { type: 'boolean', description: 'Whether the loyalty tier is active' } }, required: ['LoyaltyProgramId', 'Name'], additionalProperties: false }, description: 'Array of loyalty tier objects to create', maxItems: 1000 } }, required: ['LoyaltyTiers'], additionalProperties: false }, - src/tools/index.ts:82-82 (registration)Import of the addLoyaltyTiersTool.
import { addLoyaltyTiersTool } from './loyalty/addLoyaltyTiers.js'; - src/tools/index.ts:167-167 (registration)Inclusion of addLoyaltyTiersTool in the allTools array for registration.
addLoyaltyTiersTool, - Full tool definition including name, description, schema, and handler.
export const addLoyaltyTiersTool: Tool = { name: 'addLoyaltyTiers', description: 'Adds new loyalty tiers to the system', inputSchema: { type: 'object', properties: { ChainId: { type: 'string', description: 'Unique identifier of the chain. Required when using Portfolio Access Tokens, ignored otherwise.' }, LoyaltyTiers: { type: 'array', items: { type: 'object', properties: { LoyaltyProgramId: { type: 'string', description: 'Unique identifier of the loyalty program' }, Name: { type: 'string', description: 'Name of the loyalty tier' }, Description: { type: 'string', description: 'Description of the loyalty tier' }, Level: { type: 'number', description: 'Level of the loyalty tier (lower numbers = lower tiers)' }, MinimumPointsRequired: { type: 'number', description: 'Minimum points required to reach this tier' }, BenefitDescription: { type: 'string', description: 'Description of the benefits for this tier' }, IsActive: { type: 'boolean', description: 'Whether the loyalty tier is active' } }, required: ['LoyaltyProgramId', 'Name'], additionalProperties: false }, description: 'Array of loyalty tier objects to create', maxItems: 1000 } }, required: ['LoyaltyTiers'], additionalProperties: false }, async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const result = await mewsRequest(config, '/api/connector/v1/loyaltyTiers/add', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }