import { z } from 'zod'; import type { ToastAPIClient } from '../api-client.js'; export function registerReportingTools(client: ToastAPIClient) { return [ { name: 'toast_sales_summary', description: 'Get sales summary report for a date range', inputSchema: z.object({ startDate: z.string().describe('Start date (ISO 8601 format)'), endDate: z.string().describe('End date (ISO 8601 format)'), }), execute: async (args: any) => { // This would aggregate data from orders and payments const orders = await client.orders.list({ startDate: args.startDate, endDate: args.endDate, }); const payments = await client.payments.list(args.startDate, args.endDate); // Calculate summary metrics const summary = { dateRange: { startDate: args.startDate, endDate: args.endDate }, orders: orders.data, payments: payments.data, summary: { totalOrders: orders.totalCount, totalPayments: payments.totalCount, message: 'Sales summary data retrieved. Process orders and payments to calculate metrics.', }, }; return { content: [ { type: 'text', text: JSON.stringify(summary, null, 2), }, ], }; }, }, { name: 'toast_labor_cost_report', description: 'Get labor cost report for a business date', inputSchema: z.object({ businessDate: z.string().describe('Business date (YYYYMMDD format)'), }), execute: async (args: any) => { const result = await client.labor.getLaborCost(args.businessDate); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }, }, { name: 'toast_menu_item_performance', description: 'Get menu item sales performance for a date range', inputSchema: z.object({ startDate: z.string().describe('Start date (ISO 8601 format)'), endDate: z.string().describe('End date (ISO 8601 format)'), }), execute: async (args: any) => { // Fetch orders and aggregate item sales const orders = await client.orders.list({ startDate: args.startDate, endDate: args.endDate, }); const report = { dateRange: { startDate: args.startDate, endDate: args.endDate }, orders: orders.data, message: 'Menu item performance data retrieved. Process order selections to calculate metrics.', }; return { content: [ { type: 'text', text: JSON.stringify(report, null, 2), }, ], }; }, }, { name: 'toast_revenue_by_hour', description: 'Get revenue breakdown by hour for a date range', inputSchema: z.object({ startDate: z.string().describe('Start date (ISO 8601 format)'), endDate: z.string().describe('End date (ISO 8601 format)'), }), execute: async (args: any) => { const orders = await client.orders.list({ startDate: args.startDate, endDate: args.endDate, }); const report = { dateRange: { startDate: args.startDate, endDate: args.endDate }, orders: orders.data, message: 'Hourly revenue data retrieved. Process order timestamps to calculate hourly breakdown.', }; return { content: [ { type: 'text', text: JSON.stringify(report, null, 2), }, ], }; }, }, { name: 'toast_tip_summary', description: 'Get tip summary report for a date range', inputSchema: z.object({ startDate: z.string().describe('Start date (ISO 8601 format)'), endDate: z.string().describe('End date (ISO 8601 format)'), }), execute: async (args: any) => { const tips = await client.payments.listTips(args.startDate, args.endDate); return { content: [ { type: 'text', text: JSON.stringify(tips, null, 2), }, ], }; }, }, ]; }