Skip to main content
Glama

data_list_orders

Retrieve unvalidated quotes or validated orders/invoices within specified date ranges, with optional delivery method filtering for sales recorder systems.

Instructions

Listez soit les commandes non validées (les devis) dont la date de création est comprise entre from_date_ISO8601 et to_date_ISO8601, soit les commandes validées (dénommées commandes ou factures) dont la date de valeur est comprise entre from_date_ISO8601 et to_date_ISO8601. Vous pouvez également filtrer les modes de livraison (avec filterDeliveryMethod).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
validatedOrdersYes
from_date_ISO8601Yes
to_date_ISO8601Yes
filterDeliveryMethodNo

Implementation Reference

  • The core handler function for the 'data_list_orders' tool. It authenticates using resolveAuth, fetches order data via HTTP GET to '/workers/getOrders.php' with provided parameters, and returns structured data using structData.
    async ({ validatedOrders, from_date_ISO8601, to_date_ISO8601, filterDeliveryMethod }: getOrdersArgs, ctx: Ctx) => { const { shopId, apiKey } = resolveAuth(undefined, ctx); const data = await get('/workers/getOrders.php', { idboutique: shopId, key: apiKey, validatedOrders, from_date_ISO8601, to_date_ISO8601, filterDeliveryMethod }); return structData(data); //return { content, structuredContent: isText ? undefined : data }; }
  • Zod schema definition (getOrdersShape) and inferred TypeScript type (getOrdersArgs) for input parameters of the 'data_list_orders' tool.
    const getOrdersShape = { validatedOrders: z.boolean(), from_date_ISO8601: z.string().datetime(), to_date_ISO8601: z.string().datetime(), filterDeliveryMethod: z.union([ z.number().int().min(0).max(6), z.enum(['0', '1', '2', '3', '4', '5', '6']) ]).transform((v) => Number(v)).optional(), } satisfies Record<string, ZodTypeAny>; type CommonArgs = InferFromShape<typeof CommonShape>; type getOrderArgs = InferFromShape<typeof getOrderShape>; type getOrdersArgs = InferFromShape<typeof getOrdersShape>;
  • Registration of the 'data_list_orders' tool on the MCP server, including schema reference and inline handler function.
    server.registerTool( 'data_list_orders', { title: t('tools.data_list_orders.title'), description: t('tools.data_list_orders.description'), inputSchema: getOrdersShape, // ZodRawShape, annotations: { readOnlyHint: true } }, async ({ validatedOrders, from_date_ISO8601, to_date_ISO8601, filterDeliveryMethod }: getOrdersArgs, ctx: Ctx) => { const { shopId, apiKey } = resolveAuth(undefined, ctx); const data = await get('/workers/getOrders.php', { idboutique: shopId, key: apiKey, validatedOrders, from_date_ISO8601, to_date_ISO8601, filterDeliveryMethod }); return structData(data); //return { content, structuredContent: isText ? undefined : data }; } );
  • Helper function 'structData' used by the handler to format the response with preview content and structured data, handling large arrays and serialization safely.
    function structData(data: any) { // on ne touche PAS à structuredContent (c’est ce que ChatGPT utilise) const light = Array.isArray(data) ? data.slice(0, 5000)//.map(({ id, nom, email, tel, ...r }) => ({ id, nom, email, tel })) : data; const maxLength = 40000; const preview = typeof light === 'string' ? (light.length > maxLength ? light.slice(0, maxLength) + '…(truncated)' : light) : safeStringify(light, 2, maxLength); // <-- aperçu court et “safe” const wrapped = Array.isArray(data) ? { data: data } : data && typeof data === 'object' ? data : { data: data }; return { content: [{ type: 'text', text: preview }], structuredContent: wrapped, }; }

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/paracetamol951/caisse-enregistreuse-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server