floor
Round down any number to its nearest integer using this mathematical function, designed for precise calculations.
Instructions
Rounds a number down to the nearest integer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | The number to round down |
Implementation Reference
- src/index.ts:212-227 (registration)Registration of the "floor" MCP tool, including JSDoc description, input schema (number: z.number()), and inline handler function that calls Arithmetic.floor and returns the floored value as text content./** * Floor operation * Rounds a number down to the nearest integer */ mathServer.tool("floor", "Rounds a number down to the nearest integer", { number: z.number().describe("The number to round down"), }, async ({ number }) => { const value = Arithmetic.floor(number) return { content: [{ type: "text", text: `${value}` }] } })
- src/Classes/Arithmetic.ts:57-65 (helper)Static helper method in Arithmetic class that implements the floor operation by calling JavaScript's Math.floor(number). This is invoked by the floor tool's handler./** * Calculate the floor of a number * @param number - Number to find the floor of * @returns floor of the number */ static floor(number: number) { const floor = Math.floor(number) return floor }