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
| 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 |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"items": {
"description": "Items to return",
"items": {
"additionalProperties": false,
"properties": {
"orderItemId": {
"description": "Order item ID to return",
"type": "string"
},
"quantity": {
"description": "Quantity to return",
"type": "number"
},
"reason": {
"description": "Reason for return",
"type": "string"
}
},
"required": [
"orderItemId",
"quantity"
],
"type": "object"
},
"type": "array"
},
"orderId": {
"description": "The ID of the order to create a return for",
"type": "string"
},
"returnAddress": {
"additionalProperties": false,
"description": "Return address information",
"properties": {
"address1": {
"description": "Address line 1",
"type": "string"
},
"address2": {
"description": "Address line 2",
"type": "string"
},
"city": {
"description": "City",
"type": "string"
},
"country": {
"description": "Country code (e.g., US)",
"type": "string"
},
"name": {
"description": "Return address name",
"type": "string"
},
"state": {
"description": "State/Province",
"type": "string"
},
"zipCode": {
"description": "Zip/Postal code",
"type": "string"
}
},
"required": [
"name",
"address1",
"city",
"state",
"zipCode",
"country"
],
"type": "object"
}
},
"required": [
"orderId",
"items"
],
"type": "object"
}
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); }