get_sales_trends
Analyze sales performance over time by retrieving trends and analytics data from ConsignCloud. Specify date ranges and time buckets to identify patterns and inform 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 implementation of the get_sales_trends tool. This method in ConsignCloudClient makes an authenticated GET request to the '/trends/sales' API endpoint using the provided date range and bucket_size parameters, returning the raw API 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 createTools(). This defines the tool's name, description, and input schema, which is returned to MCP clients via ListToolsRequestHandler.{ 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 the get_sales_trends tool, specifying required parameters and their types/validation for MCP tool calls.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 CallToolRequestSchema dispatch handler for 'get_sales_trends'. Delegates execution to the ConsignCloudClient.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) }] };