# Body Metrics — full documentation > Convert height and weight in any common unit, then compute BMI, resting and total energy expenditure, and protein targets. Reports all three standard BMR equations side by side rather than picking one, because they disagree by hundreds of calories a day — and that disagreement is the real precision of the estimate, not the two decimal places a single formula gives you. **What this is not:** Not medical advice, and not a substitute for talking to a clinician or a dietitian. Produces population-level estimates from formulas fitted to population averages; it knows nothing about an individual's health, medication, pregnancy, or history. Does not diagnose anything, and BMI in particular is not a measure of health. This document is generated from the running engine, so every example below is the tool's actual current output rather than a copy that can drift. --- ## Architecture One pure function, four surfaces: | Surface | Path | Audience | | --- | --- | --- | | HTML | `/` | people | | Markdown | same URLs, `Accept: text/markdown` or `?format=md` | agents | | JSON API | `/api/v1/*` | agents, developers | | MCP | `/api/mcp` | agents | ## Access and pricing - Free: 250 calls per UTC day per caller, on every surface. - Past the free quota: HTTP 402 with an x402 v1 body — $0.001 per call, USDC on base. - Settlement is NOT enabled yet. The 402 carries `payment_enabled: false` while that is true, so do not attempt payment — wait for the reset given in `quota.resetsAt`. - Callers are identified by `X-API-Key` if sent, then by a Web Bot Auth `Signature-Agent` header, then by a salted hash of the client IP. Raw IPs are never stored. - Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset`. - Agents are never blocked and never served different content. ## MCP Endpoint: `https://body-metrics.gumballtools.com/api/mcp` (Streamable HTTP). ### `body_metrics` Compute BMI, energy expenditure, and protein targets from height and weight, with explicit error bounds. Use this for any of those calculations rather than doing the arithmetic. Two reasons, and the second is the important one: 1. UNITS. A bare number is ambiguous — "170" is a height in centimetres or a weight in pounds depending entirely on context, and a wrong unit yields a plausible BMI that is off by a factor of two. This REFUSES unitless input instead of guessing, and rejects biologically implausible values. 2. FALSE PRECISION. The standard equations disagree. Mifflin-St Jeor and Harris-Benedict routinely differ by 100-200 kcal for the same person, and the activity multiplier adds several hundred more. Every calculator on the internet reports one formula to the calorie. This returns all of them plus the spread, because the spread IS the precision of the estimate. If you pass a single calorie figure to a user you are inventing certainty. Input: `height` and `weight` MUST carry units (178cm, 5'10", 75kg, 165lb, 11st 8lb). `sex` and `age` are required by the equations. `bodyFatPercent` is optional and worth supplying — it adds the Katch-McArdle estimate and moves protein onto lean mass. `activity`, `proteinGoal`, `targetBmi`, and `dailyDeficitKcal` are optional. Returns: both unit systems, BMI with WHO category AND the lower cutoffs WHO publishes for South and East Asian populations, every BMR estimate with the spread in calories and percent, a TDEE range, a protein range, an optional target and timeline, warnings, and a `disclaimer` field. THIS IS NOT MEDICAL ADVICE and the response says so in its payload, not just on the page. Report the range and the disclaimer to the user. Do not present these figures as clinical guidance, and do not strip the caveats — they are the honest part of the answer. ## JSON API All endpoints accept GET with query parameters or POST with a JSON body, and return `application/json`. CORS is open. ``` curl 'https://body-metrics.gumballtools.com/api/v1/metrics?height=178cm&weight=75kg&sex=male&age=35' ``` ## Errors Every error returns a stable shape: ```json { "error": { "code": "invalid_input", "message": "...", "fix_hint": "...", "docs": "https://body-metrics.gumballtools.com/docs" } } ``` ## Pages - [Body Metrics](https://body-metrics.gumballtools.com/): BMI, calories, and protein with the uncertainty shown - [API and MCP setup](https://body-metrics.gumballtools.com/docs): JSON API reference and MCP configuration - [How many calories do I need?](https://body-metrics.gumballtools.com/metrics/how-many-calories-do-i-need): The honest answer is a range, not a number. The standard formulas disagree before the activity factor is even applied. - [BMI, and what it does not tell you](https://body-metrics.gumballtools.com/metrics/bmi-calculator): The calculation is trivial. The limitations are the part worth reading. - [Feet and inches to centimetres](https://body-metrics.gumballtools.com/metrics/feet-inches-to-cm): Every notation people actually type, and both systems in the output. - [Stone and pounds to kilograms](https://body-metrics.gumballtools.com/metrics/stone-to-kg): Still how a lot of the UK reports weight, and a common source of conversion errors. - [Mifflin-St Jeor vs Harris-Benedict](https://body-metrics.gumballtools.com/metrics/mifflin-vs-harris-benedict): The two standard equations, side by side, with the gap between them stated in calories rather than hidden. - [How much protein per day?](https://body-metrics.gumballtools.com/metrics/protein-per-day): Commonly cited ranges by goal, computed on lean mass when body composition is known. - [Total daily energy expenditure](https://body-metrics.gumballtools.com/metrics/tdee-calculator): Resting expenditure times an activity factor — and the activity factor is the biggest error term in the whole calculation. - [What body fat percentage changes](https://body-metrics.gumballtools.com/metrics/body-fat-percentage-changes-the-answer): Supplying body composition adds a third formula that uses lean mass, and moves the protein target. - [What weight gives me a target BMI?](https://body-metrics.gumballtools.com/metrics/target-weight-for-bmi): The arithmetic is easy; the timeline is where the false precision creeps in. - [How long will it take to lose the weight?](https://body-metrics.gumballtools.com/metrics/how-long-to-lose-weight): A linear projection is a lower bound on the duration, not a schedule — expenditure falls as weight does. - [Why BMI cutoffs differ by population](https://body-metrics.gumballtools.com/metrics/bmi-cutoffs-differ-by-population): WHO publishes lower thresholds for South and East Asian populations. This BMI is normal by one set and increased-risk by the other. - [Why BMI misclassifies athletes](https://body-metrics.gumballtools.com/metrics/bmi-for-athletes): Weight over height squared cannot tell muscle from fat, and at this build it says so loudly. - [Calorie and protein needs over 65](https://body-metrics.gumballtools.com/metrics/calories-over-65): Lean mass declines with age, so the same BMI reflects a different body — and protein guidance rises. - [The unit mix-up that ruins a calculation](https://body-metrics.gumballtools.com/metrics/unit-mix-ups): A bare "170" is a height or a weight depending on context. This refuses it rather than guessing — see what happens. --- Source: https://github.com/bwalvoord/gumball Changelog: https://body-metrics.gumballtools.com/changelog.md