Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_categories

Retrieve product categories from CS-Cart stores to organize inventory, filter by parent category and status for efficient catalog management.

Instructions

Get list of product categories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_idNoParent category ID (0 for root categories)
statusNoCategory status filter (A=Active, D=Disabled, H=Hidden)

Implementation Reference

  • The core handler function for the 'get_categories' tool. Constructs URLSearchParams from input arguments (parent_id and status), builds the /categories endpoint, calls the shared makeRequest('GET'), and returns the API response as formatted JSON text content.
    async getCategories(args) {
      const params = new URLSearchParams();
      
      if (args.parent_id !== undefined) params.append('parent_id', args.parent_id.toString());
      if (args.status) params.append('status', args.status);
    
      const queryString = params.toString();
      const endpoint = `/categories${queryString ? `?${queryString}` : ''}`;
      
      const result = await this.makeRequest('GET', endpoint);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • src/index.js:226-243 (registration)
    Tool registration in the ListToolsRequestSchema handler's tools array, defining the name, description, and inputSchema for get_categories.
      name: 'get_categories',
      description: 'Get list of product categories',
      inputSchema: {
        type: 'object',
        properties: {
          parent_id: {
            type: 'number',
            description: 'Parent category ID (0 for root categories)',
            default: 0,
          },
          status: {
            type: 'string',
            description: 'Category status filter (A=Active, D=Disabled, H=Hidden)',
            enum: ['A', 'D', 'H'],
          },
        },
      },
    },
  • src/index.js:402-403 (registration)
    Dispatch case in the CallToolRequestSchema switch statement that calls the getCategories handler for this tool.
    case 'get_categories':
      return await this.getCategories(args);
  • Input schema defining optional parameters: parent_id (number, default 0) and status (string enum ['A','D','H']).
    inputSchema: {
      type: 'object',
      properties: {
        parent_id: {
          type: 'number',
          description: 'Parent category ID (0 for root categories)',
          default: 0,
        },
        status: {
          type: 'string',
          description: 'Category status filter (A=Active, D=Disabled, H=Hidden)',
          enum: ['A', 'D', 'H'],
        },
      },
    },

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