Skip to main content
Glama

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
NameRequiredDescriptionDefault
numberYesThe 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}`
            }]
        }
    })
  • 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
    }
Install Server

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/EthanHenrickson/math-mcp'

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