Skip to main content
Glama

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';

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