Skip to main content
Glama
paracetamol951

caisse-enregistreuse-mcp-server

Retourne la liste des rayons (catégories de produits) définis dans la boutique, avec leurs noms et taux de TVA associés. Compatible avec les formats json, csv ou html.

data_list_departments
Read-only

Retrieve department data from a sales recorder system in JSON, CSV, or HTML format to organize product categories and manage inventory.

Instructions

Liste des Lister les rayons

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNojson

Implementation Reference

  • Handler function executed for the tool: resolves authentication, performs HTTP GET to the departments endpoint with shop credentials and format, logs the response, formats data using structData, and returns structured content or error message.
    async ({ format }: CommonArgs, ctx: Ctx) => {
        try {
            const { shopId, apiKey } = resolveAuth(undefined, ctx);
            const data = await get(path, { idboutique: shopId, key: apiKey, format });
    
            process.stderr.write(
                `[caisse][tool:${toolName}] ok type=${Array.isArray(data) ? 'array' : typeof data}`
                + (Array.isArray(data) ? ` len=${data.length}` : '')
                + '\n'
            );
            //Array.isArray(data) ? data.slice(0, 50) : data
            const funcResult = structData( data);
            process.stderr.write(`[caisse][RES]  ${JSON.stringify(data)} \n`);
            process.stderr.write(`[caisse][RES] funcResult ${JSON.stringify(funcResult)} \n`);
            return funcResult;
            //return { content, structuredContent: isText ? undefined : data };
        } catch (e) {
            process.stderr.write(`[caisse][tool:${toolName}][error]\n`);
            process.stderr.write(`[caisse][tool:${toolName}][error] ${(e as Error).message}\n`);
            // renvoyer un message "propre" plutôt que laisser l’exception devenir un 424
            return {
                content: [{ type: 'text', text: `Erreur pendant la préparation de la réponse: ${(e as Error).message}` }],
                is_error: true,
            };
        }
    }
  • Input schema for the tool: optional format parameter (json, csv, html) defaulting to json.
    const CommonShape = {
        format: z.enum(['json', 'csv', 'html']).default('json'),
    } satisfies Record<string, ZodTypeAny>;
  • Specific registration of the 'data_list_departments' tool using the registerSimple helper, targeting the '/workers/getDepartments.php' endpoint.
    registerSimple(server, 'data_list_departments', '/workers/getDepartments.php', t('tools.data_list_departments.description'), t('tools.data_list_departments.title'));
  • Helper function to format raw data into MCP-compatible response with preview content and full structuredContent, 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,
        };
    }
  • Helper function to register simple data-listing tools with standardized schema, read-only annotation, and generic HTTP-fetching handler.
    function registerSimple(
        server: McpServer | any,
        toolName: string,
        path: string,
        title: string,
        entityLabel: string
    ) {
        server.registerTool(
            toolName,
            {
                title,
                description: `Liste des ${entityLabel}`,
                inputSchema: CommonShape, // ZodRawShape,
                annotations: { readOnlyHint: true }
            },
            async ({ format }: CommonArgs, ctx: Ctx) => {
                try {
                    const { shopId, apiKey } = resolveAuth(undefined, ctx);
                    const data = await get(path, { idboutique: shopId, key: apiKey, format });
    
                    process.stderr.write(
                        `[caisse][tool:${toolName}] ok type=${Array.isArray(data) ? 'array' : typeof data}`
                        + (Array.isArray(data) ? ` len=${data.length}` : '')
                        + '\n'
                    );
                    //Array.isArray(data) ? data.slice(0, 50) : data
                    const funcResult = structData( data);
                    process.stderr.write(`[caisse][RES]  ${JSON.stringify(data)} \n`);
                    process.stderr.write(`[caisse][RES] funcResult ${JSON.stringify(funcResult)} \n`);
                    return funcResult;
                    //return { content, structuredContent: isText ? undefined : data };
                } catch (e) {
                    process.stderr.write(`[caisse][tool:${toolName}][error]\n`);
                    process.stderr.write(`[caisse][tool:${toolName}][error] ${(e as Error).message}\n`);
                    // renvoyer un message "propre" plutôt que laisser l’exception devenir un 424
                    return {
                        content: [{ type: 'text', text: `Erreur pendant la préparation de la réponse: ${(e as Error).message}` }],
                        is_error: true,
                    };
                }
            }
        );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotation readOnlyHint=true already indicates this is a safe read operation. The description adds no behavioral context beyond what annotations provide—no information about rate limits, authentication needs, or what 'rayons' (departments) represent in the system. However, it doesn't contradict annotations, so it meets the lower bar with annotations present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description 'Liste des Lister les rayons' is only 4 words but is poorly structured and redundant ('Liste des' followed by 'Lister'). It's under-specified rather than concise—it doesn't front-load useful information and wastes space on repetition without adding value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter, read-only), the description is incomplete. It lacks explanation of what 'rayons' are (product categories), doesn't mention the optional format parameter, and provides no output details. With no output schema, the description should at least hint at return structure, but it doesn't.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 1 parameter and 0% schema description coverage, the description doesn't mention the 'format' parameter at all. However, since there's just one optional parameter with a clear enum (json, csv, html), the baseline is high. The description's failure to explain the parameter is less critical here, but it still misses an opportunity to clarify output formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Liste des Lister les rayons' is a tautology that essentially restates the tool name 'data_list_departments' in French. It doesn't specify what action is performed beyond listing, nor does it distinguish this tool from its many sibling list tools (e.g., data_list_products, data_list_users). The title provides more clarity, but the description itself fails to articulate purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With 14 sibling list tools available (e.g., data_list_products, data_list_users), there's no indication of what distinguishes departments from other entities, nor any mention of prerequisites, exclusions, or specific contexts where this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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