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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/insights-tools.ts:145-156 (registration)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 }] }; }); - src/tools/insights-tools.ts:148-156 (handler)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 }] }; }); - src/tools/types.ts:162-173 (schema)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' } ]; - src/tools/index.ts:178-183 (registration)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; }