Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

update_product

Modify product details in CS-Cart stores by updating name, price, stock, description, categories, or status using product ID.

Instructions

Update an existing product

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYesProduct ID to update
productNoProduct name
priceNoProduct price
category_idsNoArray of category IDs
descriptionNoProduct description
full_descriptionNoFull product description
statusNoProduct status (A=Active, D=Disabled, H=Hidden)
amountNoProduct quantity in stock
weightNoProduct weight
shipping_freightNoShipping cost

Implementation Reference

  • Executes the update_product tool by sending a PUT request to the CS-Cart API with the provided product data, excluding product_id which is used in the URL.
    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) }] }; }
  • Input schema defining the parameters for the update_product tool, requiring product_id and allowing updates to various product fields.
    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)
    Switch case in the CallToolRequestSchema handler that routes 'update_product' calls to the updateProduct method.
    case 'update_product': return await this.updateProduct(args);
  • src/index.js:139-190 (registration)
    Tool registration in the ListToolsRequestSchema response, defining name, description, and input schema for update_product.
    { 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'], }, },
  • Helper method used by the updateProduct handler to make authenticated API requests to the CS-Cart server.
    async makeRequest(method, endpoint, data = null) { const config = { method, url: `${process.env.CSCART_API_URL}${endpoint}`, headers: { 'Content-Type': 'application/json', 'Authorization': `Basic ${Buffer.from(`${process.env.CSCART_API_EMAIL}:${process.env.CSCART_API_KEY}`).toString('base64')}`, }, }; if (data) { config.data = data; } const response = await axios(config); return response.data; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hungryweb/cscart-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server