update_product
Update product details in ShipStation by providing the product ID and JSON data for the new product information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productData | Yes | JSON string containing the updated product data | |
| productId | Yes | Product ID to update |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"productData": {
"description": "JSON string containing the updated product data",
"type": "string"
},
"productId": {
"description": "Product ID to update",
"type": "number"
}
},
"required": [
"productId",
"productData"
],
"type": "object"
}
Implementation Reference
- src/tools/product-tools.js:80-94 (handler)The main handler function for the 'update_product' tool. Parses the productData JSON string and calls shipStationClient.updateProduct, returning formatted JSON response or error.handler: async ({ productId, productData }) => { try { const parsedData = JSON.parse(productData); const result = await shipStationClient.updateProduct(productId, parsedData); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } } },
- src/tools/product-tools.js:76-79 (schema)Zod input schema validation for the update_product tool inputs.schema: { productId: z.number().describe("Product ID to update"), productData: z.string().describe("JSON string containing the updated product data") },
- src/server.js:174-191 (registration)Registration of all tools, including 'update_product' from productTools array, using server.tool() in a loop.[ ...orderTools, ...shipmentTools, ...carrierTools, ...warehouseTools, ...productTools, ...customerTools, ...storeTools, ...webhookTools, ...fulfillmentTools ].forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); });
- src/api-client.js:148-150 (helper)ShipStationClient helper method that performs the actual PUT API request to update a product.async updateProduct(productId, data) { return this.request('PUT', `/products/${productId}`, data); }