get_sales_trends
Analyze sales performance over time by retrieving trend data for specified date ranges and time intervals to support business decisions.
Instructions
Get sales trends and analytics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | Yes | Start date (ISO 8601: YYYY-MM-DD) - REQUIRED | |
| end_date | Yes | End date (ISO 8601: YYYY-MM-DD) - REQUIRED | |
| bucket_size | Yes | Time bucket size - REQUIRED |
Implementation Reference
- src/client.ts:331-338 (handler)The core handler implementation for the 'get_sales_trends' tool. This method in the ConsignCloudClient class makes an HTTP GET request to the '/trends/sales' API endpoint with the provided parameters (start_date, end_date, bucket_size) and returns the response data.async getSalesTrends(params?: { start_date: string; end_date: string; bucket_size: 'day' | 'week' | 'month'; }): Promise<any> { const response = await this.client.get('/trends/sales', { params }); return response.data; }
- src/server.ts:277-289 (registration)Registration of the 'get_sales_trends' tool in the createTools() function, including name, description, and input schema. This defines the tool for the MCP server.{ name: 'get_sales_trends', description: 'Get sales trends and analytics', inputSchema: { type: 'object', properties: { start_date: { type: 'string', description: 'Start date (ISO 8601: YYYY-MM-DD) - REQUIRED' }, end_date: { type: 'string', description: 'End date (ISO 8601: YYYY-MM-DD) - REQUIRED' }, bucket_size: { type: 'string', enum: ['day', 'week', 'month'], description: 'Time bucket size - REQUIRED' }, }, required: ['start_date', 'end_date', 'bucket_size'], }, },
- src/server.ts:280-288 (schema)Input schema definition for validating parameters of the 'get_sales_trends' tool.inputSchema: { type: 'object', properties: { start_date: { type: 'string', description: 'Start date (ISO 8601: YYYY-MM-DD) - REQUIRED' }, end_date: { type: 'string', description: 'End date (ISO 8601: YYYY-MM-DD) - REQUIRED' }, bucket_size: { type: 'string', enum: ['day', 'week', 'month'], description: 'Time bucket size - REQUIRED' }, }, required: ['start_date', 'end_date', 'bucket_size'], },
- src/server.ts:495-496 (handler)MCP server request handler dispatch for 'get_sales_trends', which calls the client.getSalesTrends method and formats the response as MCP content.case 'get_sales_trends': return { content: [{ type: 'text', text: JSON.stringify(await client.getSalesTrends(args as any), null, 2) }] };