Skip to main content
Glama
Canada's Food Guide MCP Server

Canada's Food Guide MCP Server

Get Cnf Macronutrients Only

get_cnf_macronutrients_only

Fetch 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:

  1. Check ingredient data quality first: Query: SELECT ingredient_id, amount, unit FROM temp_recipe_ingredients WHERE amount IS NULL Fix missing data: UPDATE temp_recipe_ingredients SET amount = 150, unit = 'g' WHERE ingredient_id = 'salmon_001'

  2. 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)

  3. 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)
  4. 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

NameRequiredDescriptionDefault
input_dataYesContains 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

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It usefully discloses that the tool stores only 13 macronutrients and automatically updates a recipe ingredient with the CNF food code when ingredient_id and recipe_id are supplied, but it does not cover overwrite behavior, idempotency, session prerequisites, or error handling.

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

Conciseness2/5

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

The description is front-loaded with a useful purpose statement, but it then includes a lengthy SQL workflow with multiple queries and examples that are downstream usage guidance rather than necessary tool-selection information. This makes it substantially overlong for a tool definition.

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

Completeness4/5

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

Given that an output schema exists and schema coverage is complete, the description sufficiently covers the core behavior, storage effect, and optional ingredient-linking side effect. It still omits explicit sibling differentiation and edge-case behavior, but an agent can call the tool correctly from the supplied information.

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 description coverage is 100%, so the schema already documents the nested parameters. The description adds some meaning by explaining the optional linking roles of ingredient_id and recipe_id and the storage purpose of session_id, but it does not add information about preferred_units beyond what the schema provides.

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 opening sentence gives a specific verb, resource, and scope: retrieving core macronutrients for a known CNF food code, with optional ingredient linking. It implicitly separates itself from search-based siblings by requiring a food code, but it does not explicitly name alternatives such as search_and_get_cnf_macronutrients or get_cnf_nutrient_profile.

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

Usage Guidelines4/5

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

The description clearly states when to use the tool: when you have a specific CNF food code, need to link CNF data to recipe ingredients, or prepare data for session-based nutrition analysis. It lacks explicit when-not guidance and does not name sibling alternatives for cases where no food code is known or bulk lookup is needed.

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