divide
Perform division operations by dividing one number by another to calculate quotients and solve mathematical problems.
Instructions
Divide the first number by the second number.
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": "divide"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- server.py:88-93 (handler)The handler function for the 'divide' tool. It is decorated with @mcp.tool() for registration in the MCP server and implements the division logic with a check to prevent division by zero.
@mcp.tool() def divide(a: float, b: float) -> float: """Divide the first number by the second number.""" if b == 0: raise ValueError("Cannot divide by zero") return a / b