subtract
Calculate the difference between two numbers by subtracting the second from the first. This mathematical tool performs subtraction operations to find numerical results.
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)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"a": "<a>",
"b": "<b>"
},
"name": "subtract"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:41-53 (handler)The subtract tool handler function. It subtracts the second argument from the first and is registered as an MCP tool via the @mcp.tool() decorator. Input schema defined by type hints (a: float, b: float) and output float.
@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