update_product
Modify product details in CS-Cart MCP Server, including name, price, description, stock, and status, by specifying the product ID and desired updates.
Instructions
Update an existing product
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Product quantity in stock | |
| category_ids | No | Array of category IDs | |
| description | No | Product description | |
| full_description | No | Full product description | |
| price | No | Product price | |
| product | No | Product name | |
| product_id | Yes | Product ID to update | |
| shipping_freight | No | Shipping cost | |
| status | No | Product status (A=Active, D=Disabled, H=Hidden) | |
| weight | No | Product weight |
Implementation Reference
- src/index.js:469-473 (handler)The handler function for the 'update_product' tool. It extracts the product_id and spreads the remaining args as productData, then makes a PUT request to the CS-Cart API endpoint `/products/${product_id}` with the productData, and returns the JSON-stringified result.async updateProduct(args) { const { product_id, ...productData } = args; const result = await this.makeRequest('PUT', `/products/${product_id}`, productData); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/index.js:139-190 (schema)The tool schema registration in ListToolsRequestSchema, including name, description, and detailed inputSchema with properties for updating product fields and required product_id.{ name: 'update_product', description: 'Update an existing product', inputSchema: { type: 'object', properties: { product_id: { type: 'number', description: 'Product ID to update', }, product: { type: 'string', description: 'Product name', }, price: { type: 'number', description: 'Product price', }, category_ids: { type: 'array', items: { type: 'number' }, description: 'Array of category IDs', }, description: { type: 'string', description: 'Product description', }, full_description: { type: 'string', description: 'Full product description', }, status: { type: 'string', description: 'Product status (A=Active, D=Disabled, H=Hidden)', enum: ['A', 'D', 'H'], }, amount: { type: 'number', description: 'Product quantity in stock', }, weight: { type: 'number', description: 'Product weight', }, shipping_freight: { type: 'number', description: 'Shipping cost', }, }, required: ['product_id'], }, },
- src/index.js:396-397 (registration)The switch case in CallToolRequestSchema handler that dispatches to the updateProduct method when 'update_product' tool is called.case 'update_product': return await this.updateProduct(args);