Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_product

Retrieve detailed product information from CS-Cart stores using product ID for inventory management and customer support.

Instructions

Get detailed information about a specific product

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYesProduct ID

Implementation Reference

  • The primary handler function for the 'get_product' tool. It makes a GET request to the CS-Cart API endpoint `/products/{product_id}` using the makeRequest helper and returns the JSON-formatted result.
    async getProduct(args) { const result = await this.makeRequest('GET', `/products/${args.product_id}`); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • src/index.js:75-88 (registration)
    Registration of the 'get_product' tool in the ListToolsRequestSchema response, defining its name, description, and input schema.
    { name: 'get_product', description: 'Get detailed information about a specific product', inputSchema: { type: 'object', properties: { product_id: { type: 'number', description: 'Product ID', }, }, required: ['product_id'], }, },
  • The input schema defining the required 'product_id' parameter for the 'get_product' tool.
    inputSchema: { type: 'object', properties: { product_id: { type: 'number', description: 'Product ID', }, }, required: ['product_id'], },
  • Helper method used by the get_product handler (and others) to perform authenticated API requests to the CS-Cart server using axios.
    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; }
  • Dispatch case in the CallToolRequestSchema handler that routes calls to the 'get_product' tool to its implementation method.
    case 'get_product': return await this.getProduct(args);

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