get_orders_report
Generate detailed orders reports from the ShipBob API by specifying a date range and optional sales channel filter for enhanced e-commerce fulfillment insights.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | No | Filter by sales channel ID | |
| endDate | Yes | End date for the report (YYYY-MM-DD) | |
| startDate | Yes | Start date for the report (YYYY-MM-DD) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"channelId": {
"description": "Filter by sales channel ID",
"type": "string"
},
"endDate": {
"description": "End date for the report (YYYY-MM-DD)",
"type": "string"
},
"startDate": {
"description": "Start date for the report (YYYY-MM-DD)",
"type": "string"
}
},
"required": [
"startDate",
"endDate"
],
"type": "object"
}
Implementation Reference
- src/tools/reporting-tools.js:39-56 (handler)The handler function that implements the core logic of the 'get_orders_report' tool. It constructs parameters from input, fetches the report via shipbobClient, and returns formatted JSON or error response.handler: async ({ startDate, endDate, channelId }) => { try { const params = { startDate, endDate, channelId }; const report = await shipbobClient.getOrdersReport(params); return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving orders report: ${error.message}` }], isError: true }; } } },
- src/tools/reporting-tools.js:34-38 (schema)Zod schema defining the input parameters for the 'get_orders_report' tool: required startDate and endDate as strings, optional channelId.schema: { startDate: z.string().describe("Start date for the report (YYYY-MM-DD)"), endDate: z.string().describe("End date for the report (YYYY-MM-DD)"), channelId: z.string().optional().describe("Filter by sales channel ID") },
- src/server.js:58-58 (registration)Registers the reportingTools array (containing the 'get_orders_report' tool definition) with the MCP server using the registerTools utility.registerTools(reportingTools);
- src/api-client.js:167-169 (helper)ShipBobClient method called by the tool handler to fetch the orders report from the ShipBob API endpoint '/reports/orders'.async getOrdersReport(params) { return this.request('GET', '/reports/orders', null, params); }