log_body_metrics
Record body weight and skinfold measurements to track fitness progress. Input date, weight in kg, and skinfold data from sites like abdomen or chest.
Instructions
Log body weight and skinfold measurements.
Args: date: Date in YYYY-MM-DD format body_weight_kg: Body weight in kilograms (optional) skinfolds: Dictionary of skinfold measurements in mm (optional). Can be a single site like {"abdomen": 10} or multiple sites like {"chest": 12, "abdomen": 18, "thigh": 15}. Common sites: abdomen, chest, thigh, tricep, subscapular, suprailiac, midaxillary notes: Optional notes about the measurement
Example: Single belly skinfold: {"abdomen": 10} Multiple sites: {"chest": 12, "abdomen": 18, "thigh": 15}
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"date": "<date>"
},
"name": "log_body_metrics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | ||
| body_weight_kg | No | ||
| skinfolds | No | ||
| notes | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/main.py:638-679 (handler)The 'log_body_metrics' tool handler processes date, weight, skinfold measurements, and notes, saves them to the database, and returns the generated metrics ID.
def log_body_metrics( date: str, body_weight_kg: Optional[float] = None, skinfolds: Optional[dict[str, float]] = None, notes: Optional[str] = None, ) -> dict[str, int]: """Log body weight and skinfold measurements. Args: date: Date in YYYY-MM-DD format body_weight_kg: Body weight in kilograms (optional) skinfolds: Dictionary of skinfold measurements in mm (optional). Can be a single site like {"abdomen": 10} or multiple sites like {"chest": 12, "abdomen": 18, "thigh": 15}. Common sites: abdomen, chest, thigh, tricep, subscapular, suprailiac, midaxillary notes: Optional notes about the measurement Example: Single belly skinfold: {"abdomen": 10} Multiple sites: {"chest": 12, "abdomen": 18, "thigh": 15} """ date = _ensure_date(date) conn = get_connection() cursor = conn.cursor() cursor.execute( "INSERT INTO body_metrics (date, body_weight_kg, notes) VALUES (?, ?, ?)", (date, body_weight_kg, notes), ) metrics_id = cursor.lastrowid if skinfolds: for site, mm in skinfolds.items(): cursor.execute( "INSERT INTO skinfolds (body_metrics_id, site_name, mm) VALUES (?, ?, ?)", (metrics_id, site, mm), ) conn.commit() conn.close() return {"body_metrics_id": metrics_id}