list_returns
Retrieve and filter return data from ShipBob's fulfillment system by status, date range, or pagination to monitor and manage e-commerce returns.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| limit | No | Number of returns per page | |
| status | No | Filter by return status | |
| startDate | No | Start date for filtering (YYYY-MM-DD) | |
| endDate | No | End date for filtering (YYYY-MM-DD) |
Implementation Reference
- src/tools/return-tools.js:15-31 (handler)The main handler function that implements the logic for the 'list_returns' tool. It fetches returns from ShipBob API using shipbobClient.getReturns and formats the response as JSON or handles errors.
handler: async ({ page, limit, status, startDate, endDate }) => { try { const params = { page, limit, status, startDate, endDate }; const returns = await shipbobClient.getReturns(params); return { content: [{ type: "text", text: JSON.stringify(returns, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing returns: ${error.message}` }], isError: true }; } } - src/tools/return-tools.js:8-14 (schema)Zod schema defining the input parameters for the list_returns tool, including optional pagination, filtering by status and date range.
schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of returns per page"), status: z.string().optional().describe("Filter by return status"), startDate: z.string().optional().describe("Start date for filtering (YYYY-MM-DD)"), endDate: z.string().optional().describe("End date for filtering (YYYY-MM-DD)") }, - src/server.js:23-32 (registration)The registerTools function used to register all tools from the returnTools array, including list_returns, by calling server.tool with name, schema, handler, and description.
const registerTools = (toolsArray) => { toolsArray.forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); }); }; - src/server.js:55-55 (registration)Specific registration call for the returnTools array containing the list_returns tool.
registerTools(returnTools);