Skip to main content
Glama

subtract

Perform precise subtraction of two numbers, including integers or fractions, with 64-bit floating point accuracy. Returns the result as a 64-bit float for reliable mathematical computations.

Instructions

Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float. For example, subtracting 5 from 10 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
number_1Yes
number_2Yes

Implementation Reference

  • The 'subtract' tool handler: a FastMCP tool that subtracts two numbers (int or float) using NumPy float64 arithmetic, rounds to 64-bit precision, logs the operation, and returns the float result. Includes input types, docstring schema description, and full execution logic.
    @math_mcp.tool def subtract( number_1: int | float, number_2: int | float, ) -> float: """Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float. For example, subtracting 5 from 10 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2. """ result = np.round(np.float64(number_1) - np.float64(number_2), decimals=SIXTY_FOUR_BIT_FLOAT_DECIMAL_PLACES) logging.info(f"Doing subtraction: {number_1} - {number_2} -> Result: {result}") return result
  • Registration of the 'subtract' tool via the @math_mcp.tool decorator on the FastMCP server instance.
    @math_mcp.tool
  • Input schema defined by type annotations (number_1 and number_2 as int|float) and output as float, with descriptive docstring explaining usage and precision.
    def subtract( number_1: int | float, number_2: int | float, ) -> float: """Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float. For example, subtracting 5 from 10 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2. """

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

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