Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_orders

Retrieve store orders with filters for status, time period, and pagination. Use to manage and analyze sales data efficiently in CS-Cart.

Instructions

Retrieve orders from the CS-Cart store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
items_per_pageNoNumber of items per page
pageNoPage number for pagination
periodNoTime period filter (A=All time, D=Today, W=This week, M=This month, Y=This year)
statusNoOrder status filter (O=Open, P=Processed, C=Complete, F=Failed, D=Declined, B=Backordered, I=Incomplete)
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

  • The primary handler function for the 'get_orders' tool. It builds URL query parameters from input arguments and performs a GET request to the CS-Cart API's /orders endpoint via the makeRequest helper, returning a JSON-formatted response.
    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 definition for the 'get_orders' tool, registered in the ListToolsRequestSchema handler. Defines parameters for pagination, status filtering, time periods, and user-specific queries.
    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', }, }, }, },
  • src/index.js:404-405 (registration)
    Registration/dispatch point in the CallToolRequestSchema switch statement, routing calls to the getOrders handler.
    case 'get_orders': return await this.getOrders(args);
  • Shared helper method used by getOrders (and other tools) to make authenticated HTTP requests to the CS-Cart API 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; }

Other Tools

Related Tools

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