Skip to main content
Glama

get_body_metrics

Retrieve body composition data including skinfold measurements from the MCP Logger fitness tracking database to monitor physical progress over time.

Instructions

Get body metrics with skinfolds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_dateNo
to_dateNo
limitNo
offsetNo

Implementation Reference

  • The get_body_metrics function is decorated as an MCP tool and handles the retrieval of body metrics data including associated skinfolds from the database.
    def get_body_metrics(
        from_date: Optional[str] = None,
        to_date: Optional[str] = None,
        limit: int = 31,
        offset: int = 0,
    ) -> dict[str, list[dict[str, Any]]]:
        """Get body metrics with skinfolds."""
        conn = get_connection()
        cursor = conn.cursor()
    
        filters = []
        params = []
        if from_date:
            filters.append("date >= ?")
            params.append(_ensure_date(from_date))
        if to_date:
            filters.append("date <= ?")
            params.append(_ensure_date(to_date))
    
        base = "SELECT * FROM body_metrics"
        if filters:
            base += " WHERE " + " AND ".join(filters)
        base += " ORDER BY date DESC LIMIT ? OFFSET ?"
        params.extend([limit, offset])
    
        cursor.execute(base, params)
        metrics_list = []
        for row in cursor.fetchall():
            metrics = _row_to_dict(row)
            cursor.execute("SELECT site_name, mm FROM skinfolds WHERE body_metrics_id = ?", (metrics["id"],))
            skinfolds = {r["site_name"]: r["mm"] for r in cursor.fetchall()}
            metrics["skinfolds"] = skinfolds
            metrics_list.append(metrics)
    
        conn.close()
        return {"metrics": metrics_list}

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