Skip to main content
Glama
code-rabi

Mews MCP

by code-rabi

getAllLoyaltyMemberships

Retrieve all loyalty memberships from Mews hospitality platform with optional filters for IDs, activity states, dates, and pagination support.

Instructions

Returns all loyalty memberships of the enterprise, optionally filtered by specific loyalty membership identifiers, activity states, or other filter parameters. Note this operation uses Pagination and supports Portfolio Access Tokens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ChainIdsNoUnique identifiers of the chain. If not specified, the operation returns data for all chains within scope of the Access Token.
CreatedUtcNoThe time interval during which the membership was created (max length 3 months)
UpdatedUtcNoThe time interval during which the membership was last updated (max length 3 months)
LoyaltyMembershipIdsNoUnique identifiers of Loyalty memberships.
AccountIdsNoUnique identifiers of accounts (for example Customers or Companies) the membership is associated with.
LoyaltyProgramIdsNoUnique identifiers of Loyalty programs.
MembershipStatesNoStates of the loyalty memberships.
ActivityStatesNoWhether to return only active, only deleted or both records.
CodesNoList of loyalty membership codes, such as identification numbers printed on loyalty cards visible to the customer.
ProviderMembershipIdsNoList of unique loyalty membership identifiers assigned and managed by the external loyalty provider's system.
LimitationYesLimitation on the quantity of data returned

Implementation Reference

  • The execute method implementing the core logic of the getAllLoyaltyMemberships tool, which prepares request data with default Limitation and calls mewsRequest to the loyaltyMemberships endpoint.
    async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> {
      const inputArgs = args as Record<string, unknown>;
      
      // Ensure required parameters have defaults
      const requestData: Record<string, unknown> = {
        Limitation: {
          Count: 100
        },
        ...inputArgs
      };
    
      const result = await mewsRequest(config, '/api/connector/v1/loyaltyMemberships/getAll', requestData);
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • Input schema defining parameters for filtering and paginating loyalty memberships, including ChainIds, date ranges, IDs, states, and required Limitation.
    inputSchema: {
      type: 'object',
      properties: {
        ChainIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifiers of the chain. If not specified, the operation returns data for all chains within scope of the Access Token.',
          maxItems: 1000
        },
        CreatedUtc: {
          type: 'object',
          properties: {
            StartUtc: { type: 'string', description: 'Start of creation date range (ISO 8601)' },
            EndUtc: { type: 'string', description: 'End of creation date range (ISO 8601)' }
          },
          description: 'The time interval during which the membership was created (max length 3 months)'
        },
        UpdatedUtc: {
          type: 'object',
          properties: {
            StartUtc: { type: 'string', description: 'Start of update date range (ISO 8601)' },
            EndUtc: { type: 'string', description: 'End of update date range (ISO 8601)' }
          },
          description: 'The time interval during which the membership was last updated (max length 3 months)'
        },
        LoyaltyMembershipIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifiers of Loyalty memberships.',
          maxItems: 1000
        },
        AccountIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifiers of accounts (for example Customers or Companies) the membership is associated with.',
          maxItems: 1000
        },
        LoyaltyProgramIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifiers of Loyalty programs.',
          maxItems: 1000
        },
        MembershipStates: {
          type: 'array',
          items: { type: 'string' },
          description: 'States of the loyalty memberships.'
        },
        ActivityStates: {
          type: 'array',
          items: { type: 'string' },
          description: 'Whether to return only active, only deleted or both records.'
        },
        Codes: {
          type: 'array',
          items: { type: 'string' },
          description: 'List of loyalty membership codes, such as identification numbers printed on loyalty cards visible to the customer.',
          maxItems: 1000
        },
        ProviderMembershipIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'List of unique loyalty membership identifiers assigned and managed by the external loyalty provider\'s system.',
          maxItems: 1000
        },
        Limitation: {
          type: 'object',
          properties: {
            Count: { type: 'number', description: 'Maximum number of loyalty memberships to return' },
            Cursor: { type: 'string', description: 'Pagination cursor for next page' }
          },
          description: 'Limitation on the quantity of data returned'
        }
      },
      required: ['Limitation'],
      additionalProperties: false
    },
  • Registration of the getAllLoyaltyMembershipsTool in the allTools array, which is used for toolMap and MCP server registration.
    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,
    ];
  • Import statement that brings the tool into the index for registration.
    import { getAllLoyaltyMembershipsTool } from './loyalty/getAllLoyaltyMemberships.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/code-rabi/mews-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server