Skip to main content
Glama

order_detail

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

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

  • Handler function for 'order_detail' tool: fetches order details from '/workers/getOrder.php' using shop credentials and order_id, then structures the data for response.
    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 for 'order_detail' tool defining the required 'order_id' parameter as an integer.
    const getOrderShape = { order_id: z.number().int(), } satisfies Record<string, ZodTypeAny>;
  • Registration of the 'order_detail' tool on the MCP server, specifying title, description, input schema, 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 }; } );
  • Helper function 'structData' used by the handler to format the response with preview content and structured data, 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