Skip to main content
Glama
ai-mcp-garage

MyFitnessPal MCP Server

get_daily_macros

Retrieve daily macro and micronutrient breakdown from MyFitnessPal for nutrition tracking and analysis.

Instructions

Get comprehensive macro and micronutrient breakdown with all tracked nutrients.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo

Implementation Reference

  • The handler function for the 'get_daily_macros' tool. It retrieves daily totals and goals from MyFitnessPal, formats a comprehensive macronutrient and micronutrient breakdown, and returns it as a markdown summary using the text_response utility.
    @mcp.tool
    def get_daily_macros(date: Optional[str] = None):
        """
        Get comprehensive macro and micronutrient breakdown with all tracked nutrients.
        
        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)
            
            totals = day.totals
            goals = day.goals
            
            output = f"# Macros & Nutrients for {target_date.strftime('%B %d, %Y')}\n\n"
            
            # Macronutrients
            output += "## Macronutrients\n"
            
            def format_nutrient(name: str, display_name: str, unit: str = "g"):
                value = totals.get(name, 0)
                goal = goals.get(name, 0)
                if goal > 0:
                    return f"- **{display_name}**: {value:.0f}{unit} / {goal:.0f}{unit} ({value/goal*100:.0f}%)\n"
                else:
                    return f"- **{display_name}**: {value:.0f}{unit}\n"
            
            output += format_nutrient('calories', 'Calories', 'kcal')
            output += format_nutrient('carbohydrates', 'Carbohydrates')
            output += format_nutrient('protein', 'Protein')
            output += format_nutrient('fat', 'Fat')
            
            # Fat breakdown if available
            if 'saturated fat' in totals:
                output += f"  - Saturated: {totals.get('saturated fat', 0):.1f}g\n"
            if 'polyunsaturated fat' in totals:
                output += f"  - Polyunsaturated: {totals.get('polyunsaturated fat', 0):.1f}g\n"
            if 'monounsaturated fat' in totals:
                output += f"  - Monounsaturated: {totals.get('monounsaturated fat', 0):.1f}g\n"
            if 'trans fat' in totals:
                output += f"  - Trans: {totals.get('trans fat', 0):.1f}g\n"
            
            output += format_nutrient('fiber', 'Fiber')
            output += format_nutrient('sugar', 'Sugar')
            output += "\n"
            
            # Micronutrients
            output += "## Micronutrients\n"
            
            if 'sodium' in totals:
                output += format_nutrient('sodium', 'Sodium', 'mg')
            if 'potassium' in totals:
                output += format_nutrient('potassium', 'Potassium', 'mg')
            if 'cholesterol' in totals:
                output += format_nutrient('cholesterol', 'Cholesterol', 'mg')
            if 'vitamin a' in totals:
                output += format_nutrient('vitamin a', 'Vitamin A', '%')
            if 'vitamin c' in totals:
                output += format_nutrient('vitamin c', 'Vitamin C', '%')
            if 'calcium' in totals:
                output += format_nutrient('calcium', 'Calcium', '%')
            if 'iron' in totals:
                output += format_nutrient('iron', 'Iron', '%')
            
            return text_response(output)
            
        except Exception as e:
            return text_response(f"Error retrieving macros: {str(e)}")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't mention permissions, rate limits, data freshness, or error handling. For a tool with no annotations, this is insufficient to inform safe and effective use.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the main purpose stated first and parameter details in a separate 'Args' section. It avoids unnecessary words, but the structure could be slightly more integrated (e.g., merging the purpose and args more seamlessly). Overall, it's efficient with minimal waste.

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's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameter semantics well but lacks usage guidelines and behavioral details. Without an output schema, it doesn't explain return values, which is a gap, but the simplicity of the tool keeps it from being severely incomplete.

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 description adds meaningful semantics beyond the input schema. The schema has 0% description coverage and only defines a 'date' parameter with a default of null. The description clarifies that 'date' is in 'YYYY-MM-DD format' and 'defaults to today', providing crucial context that the schema lacks. Since there's only one parameter, this compensation is effective.

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: 'Get comprehensive macro and micronutrient breakdown with all tracked nutrients.' It specifies the verb ('Get') and resource ('macro and micronutrient breakdown'), making the function evident. However, it doesn't explicitly differentiate from sibling tools like 'get_daily_summary' or 'get_daily_meals', which might overlap in scope, so it doesn't reach a score of 5.

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. It mentions the date parameter but doesn't explain why one would choose this over siblings like 'get_daily_summary' or 'get_daily_meals', nor does it specify prerequisites or exclusions. This lack of context leaves usage unclear.

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/ai-mcp-garage/mcp-myfitnesspal'

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