get_customer_logs
List paginated activity logs for a customer to track subscription events and changes.
Instructions
List activity logs for a customer. GET /customers/{customerId}/logs. Returns paginated log entries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customerId | Yes | Customer ID (required) | |
| pageNo | No | Page number (default: 1) | |
| itemPerPage | No | Items per page (default: 25) |
Implementation Reference
- The handler function that parses input arguments, destructures customerId/pageNo/itemPerPage, and delegates to customerService.getCustomerLogs(). This is the core execution logic for the get_customer_logs tool.
async function handler(client: Client, args: Record<string, unknown> | undefined) { const parsed = schema.safeParse(args); if (!parsed.success) { return errorResult(parsed.error.errors.map((e) => e.message).join("; ")); } const { customerId, pageNo, itemPerPage } = parsed.data; return handleToolCall(() => customerService.getCustomerLogs(client, customerId, { pageNo, itemPerPage }) ); } - Zod validation schema for the tool's input: customerId (required string), pageNo (optional number), itemPerPage (optional number).
const schema = z.object({ customerId: z.string().min(1, "customerId is required"), pageNo: z.number().optional(), itemPerPage: z.number().optional(), }); - The MCP tool definition/inputSchema used for registration, declaring the tool's name='get_customer_logs', description, and JSON Schema properties with customerId as required.
const definition = { name: "get_customer_logs", description: "List activity logs for a customer. GET /customers/{customerId}/logs. Returns paginated log entries.", inputSchema: { type: "object" as const, properties: { customerId: { type: "string", description: "Customer ID (required)" }, pageNo: { type: "number", description: "Page number (default: 1)" }, itemPerPage: { type: "number", description: "Items per page (default: 25)" }, }, required: ["customerId"], }, }; - src/tools/customers/index.ts:19-19 (registration)Import of getCustomerLogsTool into the customer tools registry module.
import { getCustomerLogsTool } from "./getCustomerLogs.js"; - src/tools/customers/index.ts:41-41 (registration)getCustomerLogsTool is included in the registerCustomerTools() array, making it available for registration with the main tool registry.
getCustomerLogsTool,