Skip to main content
Glama
JagjeevanAK

OpenFoodFacts-mcp

by JagjeevanAK

getInsightTypes

Retrieve a summary of AI insight types available in Robotoff for food data analysis.

Instructions

Get a summary of available AI insight types in Robotoff

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'getInsightTypes' tool on the MCP server. It registers the tool with an empty inputSchema (no parameters needed) and provides a description.
    server.registerTool('getInsightTypes', {
        description: 'Get a summary of available AI insight types in Robotoff',
        inputSchema: {}
    }, async () => {
        let message = '# Robotoff AI Insight Types\n\n';
        message += 'Robotoff is the AI system that analyzes product images and data.\n\n';
        INSIGHT_TYPES.forEach(t => {
            message += `- **${t.type}**: ${t.description}\n`;
        });
    
        return { content: [{ type: 'text' as const, text: message }] };
    });
  • The actual handler function for the 'getInsightTypes' tool. It iterates over the INSIGHT_TYPES constant array and builds a markdown-formatted summary of all available AI insight types and their descriptions.
    }, async () => {
        let message = '# Robotoff AI Insight Types\n\n';
        message += 'Robotoff is the AI system that analyzes product images and data.\n\n';
        INSIGHT_TYPES.forEach(t => {
            message += `- **${t.type}**: ${t.description}\n`;
        });
    
        return { content: [{ type: 'text' as const, text: message }] };
    });
  • The INSIGHT_TYPES constant array that defines the data used by the handler. Contains 10 insight types (label, category, product_weight, brand, expiration_date, packaging, store, nutrient, ingredient_spellcheck, nutrition_image) with their descriptions.
    export const INSIGHT_TYPES = [
        { type: 'label', description: 'Detected product labels (organic, fair-trade, etc.)' },
        { type: 'category', description: 'Product category suggestions' },
        { type: 'product_weight', description: 'Detected product weight/quantity' },
        { type: 'brand', description: 'Brand name detection' },
        { type: 'expiration_date', description: 'Expiration date detection from images' },
        { type: 'packaging', description: 'Packaging material and type' },
        { type: 'store', description: 'Store/retailer information' },
        { type: 'nutrient', description: 'Nutritional value detection' },
        { type: 'ingredient_spellcheck', description: 'Ingredient spellings corrections' },
        { type: 'nutrition_image', description: 'Nutrition table image detection' }
    ];
  • The registration of the registerInsightsTools function (which registers the getInsightTypes tool) is called from the main registerTools function.
      registerInsightsTools(server);
    
      registerPriceTools(server);
    
      logger.info("All OpenFoodFacts MCP tools registered successfully");
    }
  • src/server.ts:22-210 (registration)
    The server startup entrypoint that calls registerTools(server), which ultimately wires up the getInsightTypes tool registration.
      registerTools(server);
    
      server.registerResource(
        'help',
        'openfoodfacts://help',
        {
          title: 'Quick Help Guide',
          description: 'How to use the Open Food Facts tools - quick reference',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerResource(
        'nutriscore-guide',
        'openfoodfacts://nutriscore-guide',
        {
          title: 'Nutri-Score Guide',
          description: 'Understanding Nutri-Score health ratings (A-E)',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerResource(
        'ecoscore-guide',
        'openfoodfacts://ecoscore-guide',
        {
          title: 'Eco-Score Guide',
          description: 'Understanding Eco-Score environmental ratings (A-E)',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerResource(
        'allergens-list',
        'openfoodfacts://allergens-list',
        {
          title: 'Allergens Reference',
          description: 'Common food allergens and where they hide',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerResource(
        'additives-guide',
        'openfoodfacts://additives-guide',
        {
          title: 'Food Additives Guide',
          description: 'Understanding E-numbers and food additives',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerResource(
        'nova-guide',
        'openfoodfacts://nova-guide',
        {
          title: 'NOVA Processing Guide',
          description: 'Understanding food processing levels (1-4)',
          mimeType: 'text/markdown'
        },
        async (uri) => handleStaticResource(uri.href)
      );
    
      server.registerPrompt(
        'analyze-product',
        {
          title: 'Analyze Product',
          description: 'Get a detailed health analysis of any food product',
          argsSchema: {
            barcode: z.string().describe('Product barcode or name')
          }
        },
        ({ barcode }) => ({
          messages: [
            {
              role: 'user',
              content: {
                type: 'text',
                text: `Analyze the food product "${barcode}". Provide a comprehensive nutritional analysis including health implications, ingredient quality, allergens, and dietary considerations.`
              }
            }
          ]
        })
      );
    
      server.registerPrompt(
        'compare-products',
        {
          title: 'Compare Products',
          description: 'Compare two products to find the healthier option',
          argsSchema: {
            product1: z.string().describe('First product (barcode or name)'),
            product2: z.string().describe('Second product (barcode or name)')
          }
        },
        ({ product1, product2 }) => ({
          messages: [
            {
              role: 'user',
              content: {
                type: 'text',
                text: `Compare "${product1}" and "${product2}". Tell me which is healthier and why, comparing nutritional values, ingredients, and health scores.`
              }
            }
          ]
        })
      );
    
      server.registerPrompt(
        'find-healthy-alternatives',
        {
          title: 'Find Healthy Alternatives',
          description: 'Find healthier alternatives to a product',
          argsSchema: {
            product: z.string().describe('Product to find alternatives for')
          }
        },
        ({ product }) => ({
          messages: [
            {
              role: 'user',
              content: {
                type: 'text',
                text: `I want healthier alternatives to "${product}". Search for similar products with better Nutri-Score ratings and fewer additives.`
              }
            }
          ]
        })
      );
    
      server.registerPrompt(
        'check-allergens',
        {
          title: 'Check Allergens',
          description: 'Check if a product is safe for your allergies',
          argsSchema: {
            product: z.string().describe('Product barcode or name'),
            allergens: z.string().describe('Your allergens (comma-separated)')
          }
        },
        ({ product, allergens }) => ({
          messages: [
            {
              role: 'user',
              content: {
                type: 'text',
                text: `Check if "${product}" is safe for someone allergic to: ${allergens}. Include any traces warnings.`
              }
            }
          ]
        })
      );
    
      server.registerPrompt(
        'whats-for-dinner',
        {
          title: "What's for Dinner?",
          description: 'Get recipe ideas using a product',
          argsSchema: {
            product: z.string().describe('Main ingredient or product')
          }
        },
        ({ product }) => ({
          messages: [
            {
              role: 'user',
              content: {
                type: 'text',
                text: `Suggest healthy recipe ideas using "${product}" as a main ingredient. Include nutritional tips.`
              }
            }
          ]
        })
      );
    
      if (process.env.TRANSPORT === 'stdio') {
        await setupStdioTransport(server);
      } else {
        const app = express();
        await setupHttpTransport(server, app);
      }
    
      return server;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description must carry the burden of behavioral disclosure. It describes a read-only operation ('Get a summary') and does not mention side effects, authentication, or rate limits, but given the simplicity of a parameterless read call, the implied behavior is straightforward.

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?

The description is a single, clear sentence with no redundant words. Every word adds value, and it is front-loaded with the action and resource.

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?

Given the tool has no parameters and no output schema, the description provides the basic idea. However, it could be enhanced by briefly explaining what 'summary' means (e.g., list of type names and descriptions) or how the result can be used. The simplicity of the tool partially justifies the brevity.

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?

The tool has no parameters, and the schema coverage is 100% (trivially). The description does not need to add parameter details since there are none. The baseline for zero-parameter tools is 4, indicating adequate clarity.

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

Purpose4/5

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

The description uses the verb 'Get' and specifies the resource 'summary of available AI insight types in Robotoff', which clearly indicates the tool's purpose. It distinguishes from sibling tools like getProductInsights or getProductAIQuestions that focus on specific products or questions.

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?

The description provides no guidance on when to use this tool versus alternatives like getProductInsights or getRandomAIQuestions. There is no mention of prerequisites, context, or exclusions, leaving the agent to infer usage from the name alone.

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