Skip to main content
Glama

get_nutrition_day

Retrieve detailed daily nutrition data including meals and food items to support fitness tracking and dietary analysis.

Instructions

Get a complete nutrition day with meals and items.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool 'get_nutrition_day' is defined using the '@app.tool()' decorator. It fetches nutrition data for a specific date from the SQLite database, including meals and their constituent items, calculates the nutritional totals for the meals and the day, and returns the structured data.
    @app.tool()
    def get_nutrition_day(date: str) -> dict[str, Any | None]:
        """Get a complete nutrition day with meals and items."""
        date = _ensure_date(date)
        conn = get_connection()
        cursor = conn.cursor()
    
        cursor.execute("SELECT * FROM nutrition_days WHERE date = ?", (date,))
        day_row = cursor.fetchone()
        if not day_row:
            conn.close()
            return {"day": None}
    
        day = _row_to_dict(day_row)
        cursor.execute("SELECT * FROM meals WHERE day_id = ? ORDER BY order_index", (day["id"],))
    
        meals = []
        for meal_row in cursor.fetchall():
            meal = _row_to_dict(meal_row)
            cursor.execute("SELECT * FROM meal_items WHERE meal_id = ?", (meal["id"],))
            items = [_row_to_dict(r) for r in cursor.fetchall()]
    
            # Compute totals
            totals = {
                "calories": sum(i["calories"] for i in items),
                "protein_g": sum(i["protein_g"] for i in items),
                "carbs_g": sum(i["carbs_g"] for i in items),
                "fats_g": sum(i["fats_g"] for i in items),
                "fiber_g": sum(i["fiber_g"] for i in items),
            }
            meal["items"] = items
            meal["totals"] = totals
            meals.append(meal)
    
        # Compute day totals
        day["totals"] = {
            "calories": sum(m["totals"]["calories"] for m in meals),
            "protein_g": sum(m["totals"]["protein_g"] for m in meals),
            "carbs_g": sum(m["totals"]["carbs_g"] for m in meals),
            "fats_g": sum(m["totals"]["fats_g"] for m in meals),
            "fiber_g": sum(m["totals"]["fiber_g"] for m in meals),
        }
        day["meals"] = meals
        conn.close()
        return {"day": day}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'Get's data, implying a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns paginated results, or handles errors. This leaves significant gaps in understanding the tool's behavior beyond basic functionality.

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 extremely concise and front-loaded in a single sentence, with no wasted words. It efficiently communicates the core purpose without unnecessary details, making it easy for an agent to parse quickly.

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 an output schema, the description doesn't need to explain return values, which helps completeness. However, with no annotations, low schema coverage, and multiple sibling tools, the description is minimal and lacks context about usage, parameters, and behavior, making it only adequate for basic understanding but insufficient for optimal tool selection.

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?

The description adds no parameter semantics beyond what the input schema provides, as schema description coverage is 0%. It doesn't explain the 'date' parameter's format (e.g., YYYY-MM-DD) or constraints. However, with only one parameter, the baseline is 4, but the lack of any descriptive context reduces it to 3, as the schema alone is insufficient for full understanding.

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 clearly states the tool's purpose with a specific verb ('Get') and resource ('complete nutrition day with meals and items'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_nutrition_days_summary' or 'upsert_nutrition_day', which would require more specific scope or context.

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 such as 'get_nutrition_days_summary' for summaries or 'upsert_nutrition_day' for updates. It lacks context about prerequisites, timing, or exclusions, leaving the agent to infer usage from the tool name alone.

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/JohnZolton/MCP-logger'

If you have feedback or need assistance with the MCP directory API, please join our Discord server