stats_get
Get aggregated transaction, revenue, and usage statistics from your Iaptic account, including active subscriptions, customer growth, and revenue by product type.
Instructions
Get general transactions, revenue and usage statistics from your Iaptic account.
Returns aggregated metrics including:
Total revenue
Number of active subscriptions
Customer growth metrics
Transaction success rates
Revenue by product type
Data is aggregated across all your applications
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/statistics.ts:104-111 (handler)The actual handler for the 'stats_get' tool. It calls this.api.getStats({ appName }) and returns the result as JSON text.
case 'stats_get': const stats = await this.api.getStats({ appName: args.appName }); return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] }; - src/tools/statistics.ts:24-45 (schema)Schema definition and registration for the 'stats_get' tool. Defines name, description, and optional inputSchema with appName parameter when using master key.
{ name: "stats_get", description: `Get general transactions, revenue and usage statistics from your Iaptic account. - Returns aggregated metrics including: - Total revenue - Number of active subscriptions - Customer growth metrics - Transaction success rates - Revenue by product type - Data is aggregated across all your applications${appNameRequired ? '\n- Requires appName parameter when using master key' : ''}`, inputSchema: { type: "object", properties: { ...(appNameRequired ? { appName: { type: "string", description: "Name of the app to fetch data from. Required when using master key." } } : {}) }, required: appNameRequired ? ["appName"] : undefined } - src/server.ts:68-82 (registration)Registration in the MCP server: tools are listed via ListToolsRequestSchema handler (line 76) and routed to StatisticsTools.handleTool when name starts with 'stats_' (line 99-100).
private setupHandlers() { // List available tools this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...this.tools.customers.getTools(), ...this.tools.purchases.getTools(), ...this.tools.transactions.getTools(), ...this.tools.statistics.getTools(), ...this.tools.stripe.getTools(), ...this.tools.events.getTools(), ...this.tools.app.getTools() ] }; }); - src/iaptic-api.ts:209-212 (helper)The API helper: IapticAPI.getStats() makes a GET request to '/stats' endpoint. This is what the handler calls to fetch statistics data.
async getStats(params?: { appName?: string }) { const response = await this.client.get('/stats', { params }); return response.data; }