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;
    }
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 behavioral traits. It only states 'Get a summary' without mentioning safety (read-only), authorization, rate limits, or what the summary contains.

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?

Single sentence with no wasted words. Information is front-loaded and easy to parse.

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?

Despite simplicity, the description could specify what the summary includes (e.g., list of types, counts) to be more complete, but it is minimally adequate for a parameterless tool.

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?

Tool has zero parameters, and the description adds no further parameter info, which is acceptable per guidelines (baseline 4). No parameter details are needed beyond the empty schema.

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?

Description clearly states it retrieves a summary of available AI insight types in Robotoff, using a specific verb and resource. This distinguishes it from sibling tools like getProductInsights which retrieve insights for specific products.

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

Usage Guidelines3/5

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

The description implies usage for obtaining a list of insight types, but provides no explicit when-to-use or when-not-to-use guidance, nor references to alternative tools.

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