Skip to main content
Glama
ChenReuven

MCP TypeScript Simple Template

by ChenReuven

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
NameRequiredDescriptionDefault
heightMYes
weightKgYes

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)) }] })
  • 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)) }] }) );

Other Tools

Related Tools

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/ChenReuven/mcp-ts-simple-template'

If you have feedback or need assistance with the MCP directory API, please join our Discord server