Skip to main content
Glama
code-rabi

Mews MCP

by code-rabi

getAllCustomers

Retrieve customer data from Mews hospitality platform using filters like IDs, names, emails, or date ranges. Returns active customers by default when no filters are specified.

Instructions

Get customers with filters. Note: At least one filter must be provided (CustomerIds, Emails, FirstNames, LastNames, LoyaltyCodes, CompanyIds, CreatedUtc, UpdatedUtc, or DeletedUtc). If no filters are specified, defaults to ActivityStates: ["Active"] to return all active customers. IMPORTANT LIMITATIONS: Date range filters (CreatedUtc, UpdatedUtc, DeletedUtc) have a maximum interval of 3 months and 1 day. All array filters have specific maximum item limits (typically 1000, except CompanyIds which is limited to 1).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ChainIdsNoUnique identifiers of the chains. Required when using Portfolio Access Tokens, ignored otherwise.
CreatedUtcNoInterval in which Customer was created (max length 3 months)
UpdatedUtcNoInterval in which Customer was updated (max length 3 months)
DeletedUtcNoInterval in which Customer was deleted (max length 3 months)
ExtentNoExtent of data to be returned
ActivityStatesNoWhether to return only active, only deleted or both records
CustomerIdsNoUnique identifiers of Customers. Required if no other filter is provided.
CompanyIdsNoUnique identifier of the Company the customer is associated with
EmailsNoEmails of the Customers
FirstNamesNoFirst names of the Customers
LastNamesNoLast names of the Customers
LoyaltyCodesNoLoyalty codes of the Customers
LimitationNoLimitation on the quantity of data returned

Implementation Reference

  • The main handler function for the 'getAllCustomers' tool. It processes input arguments, applies defaults and filters if necessary, makes an authenticated HTTP request to the Mews API endpoint '/api/connector/v1/customers/getAll', and returns the JSON response.
    async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> {
      const inputArgs = args as Record<string, unknown>;
      
      // Check if at least one meaningful filter is provided (excluding ActivityStates)
      const hasFilter = Boolean(
        inputArgs.CustomerIds ||
        inputArgs.Emails ||
        inputArgs.FirstNames ||
        inputArgs.LastNames ||
        inputArgs.LoyaltyCodes ||
        inputArgs.CompanyIds ||
        inputArgs.CreatedUtc ||
        inputArgs.UpdatedUtc ||
        inputArgs.DeletedUtc
      );
    
      // Ensure required parameters have defaults
      const requestData: Record<string, unknown> = {
        Extent: {
          Customers: true,
          Addresses: false,
          Documents: false
        },
        Limitation: {
          Count: 100
        },
        ...inputArgs
      };
    
      // If no meaningful filters provided, add a default recent date range filter
      if (!hasFilter) {
        const endDate = new Date();
        const startDate = new Date();
        startDate.setMonth(startDate.getMonth() - 3); // 3 months ago
        
        requestData.CreatedUtc = {
          StartUtc: startDate.toISOString(),
          EndUtc: endDate.toISOString()
        };
      }
    
      const result = await mewsRequest(config, '/api/connector/v1/customers/getAll', requestData);
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • Detailed input schema for the getAllCustomers tool, defining all possible filter parameters, extents, and limitations with descriptions, types, and constraints.
    inputSchema: {
      type: 'object',
      properties: {
        ChainIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifiers of the chains. Required when using Portfolio Access Tokens, ignored otherwise.',
          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: 'Interval in which Customer 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: 'Interval in which Customer was updated (max length 3 months)'
        },
        DeletedUtc: {
          type: 'object',
          properties: {
            StartUtc: { type: 'string', description: 'Start of deletion date range (ISO 8601)' },
            EndUtc: { type: 'string', description: 'End of deletion date range (ISO 8601)' }
          },
          description: 'Interval in which Customer was deleted (max length 3 months)'
        },
        Extent: {
          type: 'object',
          properties: {
            Customers: { type: 'boolean', description: 'Whether the response should contain information about customers' },
            Addresses: { type: 'boolean', description: 'Whether the response should contain addresses of customers' },
            Documents: { type: 'boolean', description: 'Whether the response should contain identity documents of customers (deprecated)' }
          },
          description: 'Extent of data to be returned'
        },
        ActivityStates: { 
          type: 'array', 
          items: { type: 'string' },
          description: 'Whether to return only active, only deleted or both records'
        },
        CustomerIds: { 
          type: 'array', 
          items: { type: 'string' },
          description: 'Unique identifiers of Customers. Required if no other filter is provided.',
          maxItems: 1000
        },
        CompanyIds: {
          type: 'array',
          items: { type: 'string' },
          description: 'Unique identifier of the Company the customer is associated with',
          maxItems: 1
        },
        Emails: { 
          type: 'array', 
          items: { type: 'string' },
          description: 'Emails of the Customers',
          maxItems: 1000
        },
        FirstNames: { 
          type: 'array', 
          items: { type: 'string' },
          description: 'First names of the Customers',
          maxItems: 1000
        },
        LastNames: { 
          type: 'array', 
          items: { type: 'string' },
          description: 'Last names of the Customers',
          maxItems: 1000
        },
        LoyaltyCodes: {
          type: 'array',
          items: { type: 'string' },
          description: 'Loyalty codes of the Customers',
          maxItems: 1000
        },
        Limitation: {
          type: 'object',
          properties: {
            Count: { type: 'number', description: 'Maximum number of customers to return' },
            Cursor: { type: 'string', description: 'Pagination cursor for next page' }
          },
          description: 'Limitation on the quantity of data returned'
        }
      }
    },
  • The getAllCustomersTool is imported and registered in the central allTools array, which is used for MCP tool registry and lookup via toolMap.
    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/index.ts:8-8 (registration)
    Import statement that brings the getAllCustomersTool into the index module for registration.
    import { getAllCustomersTool } from './customers/getAllCustomers.js';
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the requirement for at least one filter, default filtering behavior, and important limitations like maximum date intervals (3 months and 1 day) and array limits (typically 1000, except CompanyIds limited to 1). This provides crucial operational context beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It front-loads the core purpose, then provides essential usage rules, and concludes with important limitations. Every sentence serves a clear purpose, though it could be slightly more concise by integrating the filter list more smoothly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (13 parameters, no annotations, no output schema), the description does a good job of providing necessary context. It covers usage requirements, defaults, and limitations. However, it doesn't describe the return format or pagination behavior (though Limitation parameter hints at it), leaving some gaps for a tool with this many parameters and no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 13 parameters thoroughly. The description adds value by explaining the 'at least one filter' requirement and specific limitations on date ranges and array sizes, but doesn't provide additional semantic meaning for individual parameters beyond what's in the schema. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get customers with filters.' It specifies the resource (customers) and the action (get with filtering). However, it doesn't explicitly distinguish this from sibling tools like 'getAllCompanies' or 'getAllReservations' beyond the resource name, so it doesn't fully achieve sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidelines: 'At least one filter must be provided' and lists the specific filters. It also states the default behavior when no filters are specified (ActivityStates: ['Active']). This gives clear instructions on when and how to use the tool, including edge cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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