Skip to main content
Glama
JagjeevanAK

OpenFoodFacts-mcp

by JagjeevanAK

getAdditivesInfo

List additives in a food product with E-numbers and NOVA processing level by entering a product name or barcode.

Instructions

List all additives in a product with their E-numbers and NOVA processing level

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameOrBarcodeYesProduct name or barcode (EAN/UPC)

Implementation Reference

  • The actual implementation of getAdditivesInfo. It extracts additives_tags (or additives_original_tags) from a product, maps them to E-number names, and returns an AdditivesResult with barcode, product name, additives list, count, novaGroup, and NOVA explanation.
    export function getAdditivesInfo(product: any): AdditivesResult {
        const additivesTags = product.additives_tags || [];
        const additivesOriginalTags = product.additives_original_tags || [];
        const novaGroup = product.novaGroup || product.nova_group || 0;
    
        const additives = (additivesTags.length > 0 ? additivesTags : additivesOriginalTags).map((tag: string) => {
            const match = tag.match(/en:(e\d+[a-z]?)/i);
            return {
                tag: tag,
                name: match ? match[1].toUpperCase() : tag.replace('en:', '').toUpperCase()
            };
        });
    
        return {
            barcode: product.barcode || product.code,
            productName: product.name || product.product_name || 'Unknown',
            additives,
            count: additives.length,
            novaGroup,
            novaExplanation: NOVA_EXPLANATIONS[novaGroup] || 'NOVA group not available'
        };
    }
  • The AdditivesResult interface defining the return type shape: barcode, productName, additives (array of tag/name), count, novaGroup, and novaExplanation.
    export interface AdditivesResult {
        barcode: string;
        productName: string;
        additives: Array<{
            tag: string;
            name: string;
        }>;
        count: number;
        novaGroup: number;
        novaExplanation: string;
    }
  • Registration of the 'getAdditivesInfo' tool on the MCP server. Defines description, input schema (nameOrBarcode), and the callback handler that calls findProduct then getAdditivesInfo.
    server.registerTool('getAdditivesInfo', {
        description: 'List all additives in a product with their E-numbers and NOVA processing level',
        inputSchema: productIdentifierSchema
    }, async ({ nameOrBarcode }) => {
        try {
            const product = await findProduct(nameOrBarcode);
            if (!product) {
                return { content: [{ type: 'text' as const, text: `Product "${nameOrBarcode}" not found.` }], isError: true };
            }
            const result = getAdditivesInfo(product);
            return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
        } catch (error: any) {
            return { content: [{ type: 'text' as const, text: `Error: ${error.message}` }], isError: true };
        }
    });
  • NOVA_EXPLANATIONS constant mapping NOVA groups 1-4 to descriptions, used by getAdditivesInfo to populate novaExplanation.
    export const NOVA_EXPLANATIONS: Record<number, string> = {
        1: 'Unprocessed or minimally processed foods',
        2: 'Processed culinary ingredients',
        3: 'Processed foods',
        4: 'Ultra-processed foods - contains industrial additives'
    };
  • Documentation/reference mentioning the getAdditivesInfo tool in the list of available nutrition tools.
    | Check for allergens | \`getAllergenCheck\` - gluten, milk, nuts, etc. |
    | Check multiple allergens | \`checkMultipleAllergens\` - check several at once |
    | See additives | \`getAdditivesInfo\` - E-numbers and processing level |
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It only states it 'lists all additives', but does not address edge cases (e.g., product not found, no additives), error handling, or response format. Critical behavioral details are missing for a mutation-free tool.

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

Conciseness5/5

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

A single, front-loaded sentence with no extraneous words. Every word contributes to understanding what the tool does.

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

Completeness3/5

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

Without an output schema, the description should clarify return structure. It mentions E-numbers and NOVA level, but does not specify if the output is a list of objects or strings, or whether additional fields exist. This is adequate for a simple list tool but incomplete.

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

Parameters3/5

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

Schema coverage is 100%, so the schema already documents the parameter. The description adds no additional semantics beyond the schema's description. Baseline score of 3 is appropriate as the description does not enhance understanding.

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

Purpose5/5

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

The description uses a specific verb 'List' and resource 'additives in a product', and specifies outputs 'E-numbers and NOVA processing level'. This clearly distinguishes it from sibling tools like getProductByBarcode (full product info) and getNutriScore (nutrition).

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool versus alternatives (e.g., searchProducts, getProductByBarcode). The description only states what it does, leaving the agent to infer usage context without supporting conditions or exclusions.

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/JagjeevanAK/OpenFoodFacts-MCP'

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