Get Cnf Macronutrients Only
get_cnf_macronutrients_onlyFetch core macronutrients for a CNF food code and link them to recipe ingredients for recipe nutrition calculations.
Instructions
Retrieve core macronutrients for a specific CNF food code with automatic ingredient linking.
This tool fetches macronutrient data directly from Health Canada's CNF database using a known food code and optionally links the data to recipe ingredients for nutrition calculations. It stores only 13 essential macronutrients for efficient processing while maintaining compatibility with session-based nutrition analysis tools.
TEMP_RECIPE_MACROS WORKFLOW GUIDANCE: After using this tool, you can populate the temp_recipe_macros table for cached calculations:
Check ingredient data quality first: Query:
SELECT ingredient_id, amount, unit FROM temp_recipe_ingredients WHERE amount IS NULLFix missing data:UPDATE temp_recipe_ingredients SET amount = 150, unit = 'g' WHERE ingredient_id = 'salmon_001'Review available serving sizes for matching: Query:
SELECT per_amount, unit, nutrient_value FROM temp_cnf_nutrients WHERE cnf_food_code = '4294' AND nutrient_name = 'Energy (kcal)'Example: honey 10.0 mL → CNF options: 5.0 ml (22 kcal), 15.0 ml (65 kcal), 100.0 ml (435 kcal)Choose best serving match and populate temp_recipe_macros:
INSERT INTO temp_recipe_macros ( session_id, recipe_id, ingredient_id, cnf_food_code, matched_serving_amount, matched_serving_unit, conversion_factor, calories_per_recipe_amount, protein_per_recipe_amount, fat_per_recipe_amount, carbs_per_recipe_amount, sodium_per_recipe_amount, fiber_per_recipe_amount ) SELECT 'session_id', 'recipe_id', 'honey_001', '4294', 5.0, 'ml', (10.0 / 5.0), -- 2.0x conversion factor 22.0 * (10.0 / 5.0), -- 44.0 calories for recipe amount 0.02 * (10.0 / 5.0), -- scaled protein 0.0 * (10.0 / 5.0), -- scaled fat 5.9 * (10.0 / 5.0), -- scaled carbs 0.0 * (10.0 / 5.0), -- scaled sodium (if available) 0.0 * (10.0 / 5.0) -- scaled fiber (if available)Calculate recipe totals from cached data: Query:
SELECT SUM(calories_per_recipe_amount) as total_calories FROM temp_recipe_macros WHERE session_id = ? AND recipe_id = ?
Use this tool to:
Fetch macronutrients when you have a specific CNF food code
Link CNF data to recipe ingredients for nutrition calculations
Store streamlined nutrient data for efficient analysis
Prepare data for temp_recipe_macros population workflow
When ingredient_id and recipe_id are provided, the tool automatically updates the recipe ingredient with the CNF food code, enabling calculate_recipe_nutrition_summary to work correctly. This eliminates the need for separate linking steps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_data | Yes | Contains food_code (CNF identifier), session_id (storage location), optional ingredient_id and recipe_id (for automatic linking), and preferred_units (serving size filter) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||