get_sales_report
Generate comprehensive sales reports for specific date ranges to analyze trends, compare performance, and gain business insights for art supply store management.
Instructions
Generate comprehensive sales report for a date range with trends, comparisons, and insights.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endDate | Yes | End date in YYYY-MM-DD format | |
| startDate | Yes | Start date in YYYY-MM-DD format |
Implementation Reference
- src/index.ts:176-186 (schema)Tool schema definition with input schema requiring startDate and endDate parameters.name: 'get_sales_report', description: 'Generate comprehensive sales report for a date range with trends, comparisons, and insights.', inputSchema: { type: 'object', properties: { startDate: { type: 'string', description: 'Start date in YYYY-MM-DD format' }, endDate: { type: 'string', description: 'End date in YYYY-MM-DD format' }, }, required: ['startDate', 'endDate'], }, },
- src/index.ts:754-768 (handler)Handler function that filters sales data by date range, computes totals, averages, and returns a formatted sales report.case 'get_sales_report': { const startDate = String(args?.startDate || ''); const endDate = String(args?.endDate || ''); const periodSales = storeData.sales.filter(s => s.date >= startDate && s.date <= endDate); const totalRevenue = periodSales.reduce((sum, s) => sum + s.revenue, 0); const totalTransactions = periodSales.reduce((sum, s) => sum + s.transactions, 0); return { content: [{ type: 'text', text: `📊 Sales Report: ${startDate} to ${endDate}\n\n💰 Total Revenue: $${totalRevenue.toFixed(2)}\n🛒 Total Transactions: ${totalTransactions}\n📈 Average Transaction: $${(totalRevenue / totalTransactions).toFixed(2)}\n📅 Days in Period: ${periodSales.length}\n📊 Daily Average: $${(totalRevenue / periodSales.length).toFixed(2)}` }] }; }
- src/index.ts:42-47 (helper)Mock sales data array used by the get_sales_report handler to compute reports.sales: [ { date: '2025-10-03', revenue: 456.78, transactions: 12, topItem: 'Acrylic Paint Set' }, { date: '2025-10-02', revenue: 623.45, transactions: 18, topItem: 'Canvas Panel 16x20"' }, { date: '2025-10-01', revenue: 389.90, transactions: 9, topItem: 'Oil Paint Starter Kit' }, { date: '2025-09-30', revenue: 712.34, transactions: 21, topItem: 'Drawing Pencil Set' }, ],
- src/index.ts:516-518 (registration)Registration of all tools list handler, which includes get_sales_report in the tools array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });