Skip to main content
Glama
ai-mcp-garage

MyFitnessPal MCP Server

get_water_intake

Retrieve daily water consumption data from MyFitnessPal for tracking hydration. Specify a date in YYYY-MM-DD format to view intake for that day.

Instructions

Get water consumption for a specific day.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo

Implementation Reference

  • Handler function decorated with @mcp.tool, implementing the get_water_intake tool. Fetches daily water intake from MyFitnessPal client, converts ml to oz and cups, formats progress report as markdown, and handles errors.
    @mcp.tool
    def get_water_intake(date: Optional[str] = None):
        """
        Get water consumption for a specific day.
        
        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)
            water_ml = day.water  # Library returns milliliters
            water_oz = water_ml / 29.5735  # Convert to ounces
            water_cups = water_ml / 236.588  # Convert to cups
            
            output = f"# Water Intake for {target_date.strftime('%B %d, %Y')}\n\n"
            
            if water_ml > 0:
                output += f"**Amount**: {water_oz:.0f} oz ({water_cups:.1f} cups / {water_ml:.0f} ml)\n"
            else:
                output += "No water intake logged for this day.\n"
            
            # Add helpful context
            output += f"\n*Recommended daily intake: 64 oz (8 cups / 2000 ml)*\n"
            
            if water_ml > 0:
                progress = (water_oz / 64) * 100
                output += f"*Progress: {progress:.0f}% of recommended amount*\n"
            
            return text_response(output)
            
        except Exception as e:
            return text_response(f"Error retrieving water intake: {str(e)}")

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