List customers
deonpay_list_customersList merchants' customers with completed transactions, sorted by recent, revenue, or activity. Search by email, name, or phone to identify top or recurring buyers.
Instructions
List the merchant's customers (people who have completed at least one non-validation transaction). Use this for questions like 'who are my top customers', 'how many recurring buyers do I have', 'find customers with email containing X'. Sort by 'recent' (last transaction, default), 'revenue' (most spent), or 'transactions' (most active). Each row includes email, name, phone, first_seen_at, last_seen_at, total_transactions, total_spent in centavos, active_subscriptions and saved_cards_count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (1-based). Defaults to 1. | |
| limit | No | Page size. Maximum 100, default 20. | |
| search | No | Free-text search across email, name, phone. | |
| sort | No | Sort order. Default 'recent'. | |
| environment | No | Override the environment to query. The DeonPay API only honors this if it matches the environment baked into the API token; otherwise it is silently ignored. Useful when the same dashboard exposes both envs. |
Implementation Reference
- src/tools/customers.ts:42-44 (handler)Handler function for deonpay_list_customers — calls the DeonPay API GET /customers endpoint with pagination, search, sort, and environment params via the client.
safeHandler(async (args) => { return client.get("/customers", compact(args)); }), - src/tools/customers.ts:31-40 (schema)Input schema for deonpay_list_customers — accepts optional page, limit, search, sort (recent/revenue/transactions), and environment.
inputSchema: { page: PageSchema.optional(), limit: LimitSchema.optional(), search: z.string().optional().describe("Free-text search across email, name, phone."), sort: z .enum(["recent", "revenue", "transactions"]) .optional() .describe("Sort order. Default 'recent'."), environment: EnvironmentSchema.optional(), }, - src/tools/customers.ts:25-45 (registration)Registration of deonpay_list_customers via server.registerTool with name, metadata, and handler.
server.registerTool( "deonpay_list_customers", { title: "List customers", description: "List the merchant's customers (people who have completed at least one non-validation transaction). Use this for questions like 'who are my top customers', 'how many recurring buyers do I have', 'find customers with email containing X'. Sort by 'recent' (last transaction, default), 'revenue' (most spent), or 'transactions' (most active). Each row includes email, name, phone, first_seen_at, last_seen_at, total_transactions, total_spent in centavos, active_subscriptions and saved_cards_count.", inputSchema: { page: PageSchema.optional(), limit: LimitSchema.optional(), search: z.string().optional().describe("Free-text search across email, name, phone."), sort: z .enum(["recent", "revenue", "transactions"]) .optional() .describe("Sort order. Default 'recent'."), environment: EnvironmentSchema.optional(), }, }, safeHandler(async (args) => { return client.get("/customers", compact(args)); }), ); - src/tools/index.ts:27-29 (registration)Registration entry point — registerCustomerTools is called from registerAllTools in the tool index.
registerCustomerTools(server, client); registerMetricsTools(server, client); } - src/tools/_helpers.ts:57-68 (helper)safeHandler wraps the tool's handler function with try/catch, converting errors to MCP error results.
export function safeHandler<TArgs>( fn: (args: TArgs) => Promise<unknown>, ): (args: TArgs) => Promise<CallToolResult> { return async (args: TArgs) => { try { const value = await fn(args); return jsonResult(value); } catch (err) { return errorResult(err); } }; }