Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_orders

Retrieve and filter orders from a CS-Cart store using pagination, status filters, time periods, and user-specific queries.

Instructions

Retrieve orders from the CS-Cart store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
items_per_pageNoNumber of items per page
statusNoOrder status filter (O=Open, P=Processed, C=Complete, F=Failed, D=Declined, B=Backordered, I=Incomplete)
periodNoTime period filter (A=All time, D=Today, W=This week, M=This month, Y=This year)
time_fromNoStart date for custom period (YYYY-MM-DD)
time_toNoEnd date for custom period (YYYY-MM-DD)
user_idNoFilter by user ID

Implementation Reference

  • Main handler function for get_orders tool: constructs query parameters from args and performs GET request to CS-Cart /orders API endpoint using makeRequest helper.
    async getOrders(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.period) params.append('period', args.period);
      if (args.time_from) params.append('time_from', args.time_from);
      if (args.time_to) params.append('time_to', args.time_to);
      if (args.user_id) params.append('user_id', args.user_id.toString());
    
      const queryString = params.toString();
      const endpoint = `/orders${queryString ? `?${queryString}` : ''}`;
      
      const result = await this.makeRequest('GET', endpoint);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Input schema for the get_orders tool, defining parameters for pagination, status filtering, time periods, and user filtering.
    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: 'Order status filter (O=Open, P=Processed, C=Complete, F=Failed, D=Declined, B=Backordered, I=Incomplete)',
          enum: ['O', 'P', 'C', 'F', 'D', 'B', 'I'],
        },
        period: {
          type: 'string',
          description: 'Time period filter (A=All time, D=Today, W=This week, M=This month, Y=This year)',
          enum: ['A', 'D', 'W', 'M', 'Y'],
        },
        time_from: {
          type: 'string',
          description: 'Start date for custom period (YYYY-MM-DD)',
        },
        time_to: {
          type: 'string',
          description: 'End date for custom period (YYYY-MM-DD)',
        },
        user_id: {
          type: 'number',
          description: 'Filter by user ID',
        },
      },
    },
  • src/index.js:246-286 (registration)
    Registration of the get_orders tool in the ListToolsRequestHandler, specifying name, description, and input schema.
    {
      name: 'get_orders',
      description: 'Retrieve orders 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: 'Order status filter (O=Open, P=Processed, C=Complete, F=Failed, D=Declined, B=Backordered, I=Incomplete)',
            enum: ['O', 'P', 'C', 'F', 'D', 'B', 'I'],
          },
          period: {
            type: 'string',
            description: 'Time period filter (A=All time, D=Today, W=This week, M=This month, Y=This year)',
            enum: ['A', 'D', 'W', 'M', 'Y'],
          },
          time_from: {
            type: 'string',
            description: 'Start date for custom period (YYYY-MM-DD)',
          },
          time_to: {
            type: 'string',
            description: 'End date for custom period (YYYY-MM-DD)',
          },
          user_id: {
            type: 'number',
            description: 'Filter by user ID',
          },
        },
      },
    },
  • Shared helper method used by get_orders (and other tools) to make authenticated HTTP requests to the CS-Cart API.
    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;
    }
  • src/index.js:404-405 (registration)
    Dispatcher case in CallToolRequestHandler that routes get_orders calls to the getOrders handler method.
    case 'get_orders':
      return await this.getOrders(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