Skip to main content
Glama
ai-mcp-garage

MyFitnessPal MCP Server

get_daily_meals

Retrieve detailed meal breakdowns with foods, servings, and calories from MyFitnessPal for any date to track nutrition intake.

Instructions

Get detailed meal-by-meal breakdown with all foods, servings, and calories.

Args: date: Date in YYYY-MM-DD format (defaults to today)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo

Implementation Reference

  • The main handler function for the 'get_daily_meals' tool. It is decorated with @mcp.tool, which registers it in the FastMCP server. The function parses the date, fetches the day's data using MyFitnessPalClient, iterates through meals and entries to build a detailed markdown summary of meals, foods, servings, calories, and macros, and returns it wrapped in text_response.
    @mcp.tool
    def get_daily_meals(date: Optional[str] = None):
        """
        Get detailed meal-by-meal breakdown with all foods, servings, and calories.
        
        Args:
            date: Date in YYYY-MM-DD format (defaults to today)
        """
        try:
            target_date = parse_date(date)
            client = get_client()
            
            # Fetch day data
            day = client.get_day(target_date)
            
            output = f"# Meals for {target_date.strftime('%B %d, %Y')}\n\n"
            
            if not day.meals:
                output += "No meals logged for this day.\n"
            else:
                for meal in day.meals:
                    meal_totals = meal.totals
                    meal_calories = meal_totals.get('calories', 0)
                    
                    output += f"## {meal.name}\n"
                    output += f"**Total**: {meal_calories:.0f} kcal"
                    
                    # Show meal macros
                    meal_carbs = meal_totals.get('carbohydrates', 0)
                    meal_fat = meal_totals.get('fat', 0)
                    meal_protein = meal_totals.get('protein', 0)
                    output += f" ({meal_carbs:.0f}C / {meal_fat:.0f}F / {meal_protein:.0f}P)\n\n"
                    
                    if meal.entries:
                        for entry in meal.entries:
                            nutrition = entry.nutrition_information
                            
                            output += f"- **{entry.name}**\n"
                            output += f"  - Serving: {entry.quantity} {entry.unit}\n"
                            output += f"  - Calories: {nutrition.get('calories', 0):.0f} kcal\n"
                            output += f"  - Macros: "
                            output += f"{nutrition.get('carbohydrates', 0):.0f}C / "
                            output += f"{nutrition.get('fat', 0):.0f}F / "
                            output += f"{nutrition.get('protein', 0):.0f}P\n"
                        output += "\n"
                    else:
                        output += "No foods logged in this meal.\n\n"
            
            return text_response(output)
            
        except Exception as e:
            return text_response(f"Error retrieving meals: {str(e)}")

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description bears full responsibility. It only states what the tool returns, without disclosing behavioral traits like idempotency, rate limits, authentication needs, or side effects. This is a significant gap.

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: one sentence for purpose and one for arguments. No wasted words, front-loaded with the main action.

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?

For a simple tool with one optional parameter and no output schema, the description adequately explains the return (meal-by-meal breakdown with foods, servings, calories) and the date parameter. It could benefit from more detail on output structure, but overall is complete for typical usage.

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?

The schema has 0% description coverage for the date parameter. The description adds the required format 'YYYY-MM-DD' and clarifies that it defaults to today. This provides meaningful context beyond the raw schema.

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 verb 'Get' and resource 'daily meals', specifying a meal-by-meal breakdown with foods, servings, and calories. It differentiates from siblings like get_daily_summary or get_daily_macros by emphasizing granularity, but does not explicitly contrast them.

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 retrieving detailed meal data, but provides no explicit guidance on when to use this tool vs. alternatives (e.g., get_daily_summary). No exclusions or context for when not to use it.

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