Skip to main content
Glama

getAllCustomers

Retrieve customer data using specific filters such as IDs, emails, names, loyalty codes, or date ranges. At least one filter is required; defaults to active customers if none provided. Supports pagination and data extent selection.

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

Implementation Reference

  • The execute handler function that processes input arguments, applies defaults and filters, makes an HTTP request to the Mews API to retrieve customers, and returns the result as JSON.
    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) }] }; }
  • The inputSchema defining the structure and constraints for tool inputs, including various filters like date ranges, IDs, names, and pagination options.
    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' } } },
  • Registration of the getAllCustomersTool in the central allTools array used for tool registry and lookup.
    getAllCustomersTool,
  • src/tools/index.ts:8-8 (registration)
    Import statement that brings the tool definition into the index file 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