update_product
Modify product details in ShipBob's system, including name, SKU, dimensions, weight, and value, by specifying the product ID and relevant attributes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| barcode | No | Product barcode/UPC | |
| description | No | Product description | |
| height | No | Height in inches | |
| length | No | Length in inches | |
| name | No | Product name | |
| productId | Yes | The ID of the product to update | |
| sku | No | Stock keeping unit | |
| value | No | Declared value of the product | |
| weight | No | Weight in ounces | |
| width | No | Width in inches |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"barcode": {
"description": "Product barcode/UPC",
"type": "string"
},
"description": {
"description": "Product description",
"type": "string"
},
"height": {
"description": "Height in inches",
"type": "number"
},
"length": {
"description": "Length in inches",
"type": "number"
},
"name": {
"description": "Product name",
"type": "string"
},
"productId": {
"description": "The ID of the product to update",
"type": "string"
},
"sku": {
"description": "Stock keeping unit",
"type": "string"
},
"value": {
"description": "Declared value of the product",
"type": "number"
},
"weight": {
"description": "Weight in ounces",
"type": "number"
},
"width": {
"description": "Width in inches",
"type": "number"
}
},
"required": [
"productId"
],
"type": "object"
}
Implementation Reference
- src/tools/product-tools.js:100-114 (handler)Handler function that executes the update_product tool logic by calling the ShipBob API client to update the product and formatting the response.handler: async ({ productId, ...productData }) => { try { const updatedProduct = await shipbobClient.updateProduct(productId, productData); return { content: [{ type: "text", text: `Product updated successfully: ${JSON.stringify(updatedProduct, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating product: ${error.message}` }], isError: true }; }
- src/tools/product-tools.js:88-99 (schema)Zod schema defining the input parameters for the update_product tool.schema: { productId: z.string().describe("The ID of the product to update"), name: z.string().optional().describe("Product name"), sku: z.string().optional().describe("Stock keeping unit"), barcode: z.string().optional().describe("Product barcode/UPC"), description: z.string().optional().describe("Product description"), weight: z.number().optional().describe("Weight in ounces"), length: z.number().optional().describe("Length in inches"), width: z.number().optional().describe("Width in inches"), height: z.number().optional().describe("Height in inches"), value: z.number().optional().describe("Declared value of the product") },
- src/server.js:50-50 (registration)Registration of the productTools array to the MCP server, which includes the update_product tool.registerTools(productTools);
- src/api-client.js:67-69 (helper)Helper method in ShipBobClient that performs the actual API request to update a product.async updateProduct(id, productData) { return this.request('PUT', `/products/${id}`, productData); }
- src/tools/product-tools.js:85-116 (registration)Tool definition object for update_product, including name, description, schema, and handler, which is part of the productTools array registered to the MCP server.{ name: "update_product", description: "Update an existing product in ShipBob", schema: { productId: z.string().describe("The ID of the product to update"), name: z.string().optional().describe("Product name"), sku: z.string().optional().describe("Stock keeping unit"), barcode: z.string().optional().describe("Product barcode/UPC"), description: z.string().optional().describe("Product description"), weight: z.number().optional().describe("Weight in ounces"), length: z.number().optional().describe("Length in inches"), width: z.number().optional().describe("Width in inches"), height: z.number().optional().describe("Height in inches"), value: z.number().optional().describe("Declared value of the product") }, handler: async ({ productId, ...productData }) => { try { const updatedProduct = await shipbobClient.updateProduct(productId, productData); return { content: [{ type: "text", text: `Product updated successfully: ${JSON.stringify(updatedProduct, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating product: ${error.message}` }], isError: true }; } } }