create_shipment
Create a shipment for an order using the ShipBob API by specifying the order ID, shipping method, items, and optional fulfillment center ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fulfillmentCenterId | No | Preferred fulfillment center ID | |
| items | Yes | Items to ship | |
| orderId | Yes | The ID of the order to create a shipment for | |
| shippingMethod | Yes | Shipping method to use |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"fulfillmentCenterId": {
"description": "Preferred fulfillment center ID",
"type": "string"
},
"items": {
"description": "Items to ship",
"items": {
"additionalProperties": false,
"properties": {
"orderItemId": {
"description": "Order item ID to ship",
"type": "string"
},
"quantity": {
"description": "Quantity to ship",
"type": "number"
}
},
"required": [
"orderItemId",
"quantity"
],
"type": "object"
},
"type": "array"
},
"orderId": {
"description": "The ID of the order to create a shipment for",
"type": "string"
},
"shippingMethod": {
"description": "Shipping method to use",
"type": "string"
}
},
"required": [
"orderId",
"shippingMethod",
"items"
],
"type": "object"
}
Implementation Reference
- src/tools/fulfillment-tools.js:70-85 (handler)MCP tool handler for 'create_shipment' that calls the ShipBob API client to create the shipment and handles the response.handler: async (shipmentData) => { try { const newShipment = await shipbobClient.createShipment(shipmentData); return { content: [{ type: "text", text: `Shipment created successfully: ${JSON.stringify(newShipment, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating shipment: ${error.message}` }], isError: true }; } }
- src/tools/fulfillment-tools.js:59-69 (schema)Input schema using Zod for validating parameters to the create_shipment tool.schema: { orderId: z.string().describe("The ID of the order to create a shipment for"), fulfillmentCenterId: z.string().optional().describe("Preferred fulfillment center ID"), shippingMethod: z.string().describe("Shipping method to use"), items: z.array( z.object({ orderItemId: z.string().describe("Order item ID to ship"), quantity: z.number().describe("Quantity to ship") }) ).describe("Items to ship") },
- src/server.js:53-53 (registration)Registers the fulfillmentTools array containing the create_shipment tool with the MCP server.registerTools(fulfillmentTools);
- src/api-client.js:114-116 (helper)Helper method in ShipBobClient that performs the actual API call to create a shipment.async createShipment(shipmentData) { return this.request('POST', '/shipments', shipmentData); }