create_return
Initiate return requests for e-commerce orders by specifying order ID, return items, and return address details, streamlining the process within ShipBob API MCP Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Items to return | |
| orderId | Yes | The ID of the order to create a return for | |
| returnAddress | No | Return address information |
Implementation Reference
- src/tools/return-tools.js:78-93 (handler)The MCP tool handler for 'create_return', which calls the ShipBob API client to create the return and formats the response.handler: async (returnData) => { try { const newReturn = await shipbobClient.createReturn(returnData); return { content: [{ type: "text", text: `Return created successfully: ${JSON.stringify(newReturn, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating return: ${error.message}` }], isError: true }; } }
- src/tools/return-tools.js:59-77 (schema)Zod input schema defining parameters for creating a return: orderId, items array, and optional returnAddress.schema: { orderId: z.string().describe("The ID of the order to create a return for"), items: z.array( z.object({ orderItemId: z.string().describe("Order item ID to return"), quantity: z.number().describe("Quantity to return"), reason: z.string().optional().describe("Reason for return") }) ).describe("Items to return"), returnAddress: z.object({ name: z.string().describe("Return address name"), address1: z.string().describe("Address line 1"), address2: z.string().optional().describe("Address line 2"), city: z.string().describe("City"), state: z.string().describe("State/Province"), zipCode: z.string().describe("Zip/Postal code"), country: z.string().describe("Country code (e.g., US)") }).optional().describe("Return address information") },
- src/server.js:55-55 (registration)Registration of the returnTools array (containing create_return tool) to the MCP server via registerTools function.registerTools(returnTools);
- src/api-client.js:140-142 (helper)ShipBobClient helper method that sends POST request to ShipBob API /returns endpoint to create a return.async createReturn(returnData) { return this.request('POST', '/returns', returnData); }