adjust_inventory
Update inventory levels for specific products in ShipBob fulfillment centers by adjusting quantities with a given reason, ensuring accurate stock management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fulfillmentCenterId | Yes | The ID of the fulfillment center | |
| productId | Yes | The ID of the product to adjust | |
| quantity | Yes | Quantity to adjust (positive for addition, negative for reduction) | |
| reason | Yes | Reason for the adjustment |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"fulfillmentCenterId": {
"description": "The ID of the fulfillment center",
"type": "string"
},
"productId": {
"description": "The ID of the product to adjust",
"type": "string"
},
"quantity": {
"description": "Quantity to adjust (positive for addition, negative for reduction)",
"type": "number"
},
"reason": {
"description": "Reason for the adjustment",
"type": "string"
}
},
"required": [
"productId",
"fulfillmentCenterId",
"quantity",
"reason"
],
"type": "object"
}
Implementation Reference
- src/tools/inventory-tools.js:88-108 (handler)The asynchronous handler function that implements the core logic for the 'adjust_inventory' tool. It constructs adjustment data from inputs and delegates to shipbobClient.adjustInventory, returning formatted success or error responses.handler: async ({ productId, fulfillmentCenterId, quantity, reason }) => { try { const adjustmentData = { productId, fulfillmentCenterId, quantity, reason }; const result = await shipbobClient.adjustInventory(adjustmentData); return { content: [{ type: "text", text: `Inventory adjusted successfully: ${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error adjusting inventory: ${error.message}` }], isError: true }; }
- src/tools/inventory-tools.js:82-87 (schema)Zod-based input schema defining the required parameters for the adjust_inventory tool: productId (string), fulfillmentCenterId (string), quantity (number), reason (string).schema: { productId: z.string().describe("The ID of the product to adjust"), fulfillmentCenterId: z.string().describe("The ID of the fulfillment center"), quantity: z.number().describe("Quantity to adjust (positive for addition, negative for reduction)"), reason: z.string().describe("Reason for the adjustment") },
- src/server.js:50-58 (registration)Registration calls that invoke registerTools(inventoryTools), which registers the 'adjust_inventory' tool (among others) with the MCP server via server.tool(name, schema, handler).registerTools(productTools); registerTools(orderTools); registerTools(inventoryTools); registerTools(fulfillmentTools); registerTools(webhookTools); registerTools(returnTools); registerTools(locationTools); registerTools(channelTools); registerTools(reportingTools);
- src/api-client.js:101-103 (helper)Helper method in ShipBobClient that performs the actual HTTP POST request to the ShipBob API endpoint '/inventory/adjustments' with the adjustment data.async adjustInventory(adjustmentData) { return this.request('POST', '/inventory/adjustments', adjustmentData); }