get_water_intake
Retrieve your daily water consumption data from MyFitnessPal for hydration tracking and health monitoring.
Instructions
Get water consumption for a specific day.
Args: date: Date in YYYY-MM-DD format (defaults to today)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No |
Implementation Reference
- server.py:332-368 (handler)The main handler function for the 'get_water_intake' tool. Decorated with @mcp.tool for automatic registration in FastMCP. Parses the date, fetches the day's data from MyFitnessPalClient, extracts water intake in ml, converts to oz and cups, formats a markdown summary with progress info, and returns formatted text response.@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)}")