subtract
Calculate the difference between two numbers with 64-bit floating point precision. Supports integers, decimals, and fractions to perform subtraction operations.
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
| Name | Required | Description | Default |
|---|---|---|---|
| number_1 | Yes | ||
| number_2 | Yes |
Implementation Reference
- src/math_server.py:58-69 (handler)The core handler function for the 'subtract' tool. It is registered using the @math_mcp.tool decorator on the FastMCP server instance. The function signature provides the input schema (two numbers: int | float), docstring describes usage and output (float), and the body computes the subtraction with 64-bit precision using NumPy, including logging.@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