Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_sales_statistics

Retrieve sales data for specified time periods to analyze performance in CS-Cart stores, supporting daily, weekly, monthly, yearly, or custom date ranges.

Instructions

Get sales statistics for a specific period

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoTime period (D=Today, W=This week, M=This month, Y=This year)M
time_fromNoStart date for custom period (YYYY-MM-DD)
time_toNoEnd date for custom period (YYYY-MM-DD)

Implementation Reference

  • The handler function that implements the core logic of the get_sales_statistics tool. It constructs URL query parameters based on input arguments and fetches sales statistics from the /statistics/sales API endpoint.
    async getSalesStatistics(args) {
      const params = new URLSearchParams();
      
      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);
    
      const queryString = params.toString();
      const endpoint = `/statistics/sales${queryString ? `?${queryString}` : ''}`;
      
      const result = await this.makeRequest('GET', endpoint);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Input schema defining the parameters for the get_sales_statistics tool: period (enum with defaults), and optional custom date ranges.
    inputSchema: {
      type: 'object',
      properties: {
        period: {
          type: 'string',
          description: 'Time period (D=Today, W=This week, M=This month, Y=This year)',
          enum: ['D', 'W', 'M', 'Y'],
          default: 'M',
        },
        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)',
        },
      },
    },
  • src/index.js:358-380 (registration)
    Tool registration in the listTools method, specifying name, description, and input schema.
    {
      name: 'get_sales_statistics',
      description: 'Get sales statistics for a specific period',
      inputSchema: {
        type: 'object',
        properties: {
          period: {
            type: 'string',
            description: 'Time period (D=Today, W=This week, M=This month, Y=This year)',
            enum: ['D', 'W', 'M', 'Y'],
            default: 'M',
          },
          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)',
          },
        },
      },
    },
  • src/index.js:412-413 (registration)
    Dispatch case in the request handler switch statement that routes calls to the getSalesStatistics method.
    case 'get_sales_statistics':
      return await this.getSalesStatistics(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