subtract
Calculate the difference between two numbers by subtracting the second number from the first number. Get accurate subtraction results for mathematical operations and calculations.
Instructions
Subtract the second number from the first number.
Args:
a: The first number (minuend)
b: The second number (subtrahend)
Returns:
The difference of a and b (a - b)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Input Schema (JSON Schema)
{
"properties": {
"a": {
"title": "A",
"type": "number"
},
"b": {
"title": "B",
"type": "number"
}
},
"required": [
"a",
"b"
],
"type": "object"
}
Implementation Reference
- server.py:41-53 (handler)The main handler function for the 'subtract' tool. It is registered via the @mcp.tool() decorator. The function takes two float arguments, subtracts b from a, and returns the result. The docstring provides the tool description and parameter details used for schema generation.@mcp.tool() def subtract(a: float, b: float) -> float: """ Subtract the second number from the first number. Args: a: The first number (minuend) b: The second number (subtrahend) Returns: The difference of a and b (a - b) """ return a - b