get_sales_statistics
Retrieve sales data for a specified time frame (daily, weekly, monthly, yearly) or custom period to analyze performance on CS-Cart MCP Server.
Instructions
Get sales statistics for a specific period
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | Time period (D=Today, W=This week, M=This month, Y=This year) | M |
| time_from | No | Start date for custom period (YYYY-MM-DD) | |
| time_to | No | End date for custom period (YYYY-MM-DD) |
Implementation Reference
- src/index.js:547-559 (handler)The handler function that executes the get_sales_statistics tool by constructing query parameters and making a GET request to the /statistics/sales API endpoint.async getSalesStatistics(args) { const params = new URLSearchParams(); if (args.period) params.append('period', args.period); if (args.time_from) params.append('time_from', args.time_from); if (args.time_to) params.append('time_to', args.time_to); const queryString = params.toString(); const endpoint = `/statistics/sales${queryString ? `?${queryString}` : ''}`; const result = await this.makeRequest('GET', endpoint); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/index.js:358-380 (schema)Tool definition including name, description, and input schema for validation in the ListTools response.{ name: 'get_sales_statistics', description: 'Get sales statistics for a specific period', inputSchema: { type: 'object', properties: { period: { type: 'string', description: 'Time period (D=Today, W=This week, M=This month, Y=This year)', enum: ['D', 'W', 'M', 'Y'], default: 'M', }, time_from: { type: 'string', description: 'Start date for custom period (YYYY-MM-DD)', }, time_to: { type: 'string', description: 'End date for custom period (YYYY-MM-DD)', }, }, }, },
- src/index.js:412-413 (registration)Registration in the CallToolRequest handler switch statement that routes to the getSalesStatistics method.case 'get_sales_statistics': return await this.getSalesStatistics(args);