calculate-bmi
Calculate Body Mass Index (BMI) by entering weight in kilograms and height in meters. Use this tool to assess health metrics based on standardized BMI calculations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| heightM | Yes | ||
| weightKg | Yes |
Implementation Reference
- index.ts:32-37 (handler)The handler function computes BMI as weight in kg divided by height in meters squared, returning it as a text content block.async ({ weightKg, heightM }) => ({ content: [{ type: "text", text: String(weightKg / (heightM * heightM)) }] })
- index.ts:28-31 (schema)Input schema defining weightKg and heightM as numbers using Zod.{ weightKg: z.number(), heightM: z.number() },
- index.ts:26-38 (registration)Registers the 'calculate-bmi' tool with MCP server, including input schema and handler.server.tool( "calculate-bmi", { weightKg: z.number(), heightM: z.number() }, async ({ weightKg, heightM }) => ({ content: [{ type: "text", text: String(weightKg / (heightM * heightM)) }] }) );