Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_products

Retrieve product listings from CS-Cart stores with pagination, filtering by status, category, or search query to manage inventory and display items.

Instructions

Retrieve a list of products from the CS-Cart store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
items_per_pageNoNumber of items per page
statusNoProduct status filter (A=Active, D=Disabled, H=Hidden)
category_idNoFilter by category ID
qNoSearch query for product name

Implementation Reference

  • The handler function that executes the get_products tool. It constructs URL query parameters based on input arguments and makes a GET request to the CS-Cart /products API endpoint using the shared makeRequest helper.
    async getProducts(args) { const params = new URLSearchParams(); if (args.page) params.append('page', args.page.toString()); if (args.items_per_page) params.append('items_per_page', args.items_per_page.toString()); if (args.status) params.append('status', args.status); if (args.category_id) params.append('cid', args.category_id.toString()); if (args.q) params.append('q', args.q); const queryString = params.toString(); const endpoint = `/products${queryString ? `?${queryString}` : ''}`; const result = await this.makeRequest('GET', endpoint); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • src/index.js:44-74 (registration)
    Registration of the get_products tool in the ListToolsRequestHandler, including its metadata and input schema definition.
    name: 'get_products', description: 'Retrieve a list of products from the CS-Cart store', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination', default: 1, }, items_per_page: { type: 'number', description: 'Number of items per page', default: 10, }, status: { type: 'string', description: 'Product status filter (A=Active, D=Disabled, H=Hidden)', enum: ['A', 'D', 'H'], }, category_id: { type: 'number', description: 'Filter by category ID', }, q: { type: 'string', description: 'Search query for product name', }, }, }, },
  • src/index.js:390-391 (registration)
    Dispatch/registration logic in the CallToolRequestHandler switch statement that routes calls to the getProducts handler.
    case 'get_products': return await this.getProducts(args);
  • Input schema definition for the get_products tool, specifying parameters for pagination, filtering, and search.
    inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number for pagination', default: 1, }, items_per_page: { type: 'number', description: 'Number of items per page', default: 10, }, status: { type: 'string', description: 'Product status filter (A=Active, D=Disabled, H=Hidden)', enum: ['A', 'D', 'H'], }, category_id: { type: 'number', description: 'Filter by category ID', }, q: { type: 'string', description: 'Search query for product name', }, }, },
  • Shared helper method used by getProducts (and other tools) 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