Skip to main content
Glama
paracetamol951

caisse-enregistreuse-mcp-server

order_detail

Retrieve complete order information including sold items, customer details, payment method, and total amount using the unique order identifier.

Instructions

Récupère toutes les informations d’une commande à partir de son identifiant unique, y compris les articles vendus, le client, le mode de paiement et le montant total.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
order_idYes

Implementation Reference

  • The handler function that implements the core logic of the 'order_detail' tool. It resolves shop authentication, makes an HTTP GET request to the PHP backend endpoint '/workers/getOrder.php' with the order_id, and returns the structured response using the shared structData helper.
    async ({ order_id }: getOrderArgs, ctx: Ctx) => {
        const { shopId, apiKey } = resolveAuth(undefined, ctx);
        const data = await get('/workers/getOrder.php', { idboutique: shopId, key: apiKey, order_id });
    
        return structData(data);
        //return { content, structuredContent: isText ? undefined : data };
    }
  • Zod input schema shape for the 'order_detail' tool, defining the required 'order_id' parameter as an integer.
    const getOrderShape = {
        order_id: z.number().int(),
    } satisfies Record<string, ZodTypeAny>;
  • The server.registerTool call that registers the 'order_detail' tool, including metadata (title, description from i18n), input schema reference, read-only annotation, and inline handler function.
    server.registerTool(
        'order_detail',
        {
            title: t('tools.order_detail.title'),
            description: t('tools.order_detail.description'),
            inputSchema: getOrderShape, // ZodRawShape,
            annotations: { readOnlyHint: true }
        },
        async ({ order_id }: getOrderArgs, ctx: Ctx) => {
            const { shopId, apiKey } = resolveAuth(undefined, ctx);
            const data = await get('/workers/getOrder.php', { idboutique: shopId, key: apiKey, order_id });
    
            return structData(data);
            //return { content, structuredContent: isText ? undefined : data };
        }
    );
  • TypeScript type definition for the input arguments of the order_detail handler, inferred from the Zod schema.
    type getOrderArgs = InferFromShape<typeof getOrderShape>;
  • Shared helper function used by order_detail (and other data tools) to format arbitrary data into MCP-standard response with text preview and structured content, handling truncation 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