divide
Divide one number by another to perform mathematical division operations and calculate quotients.
Instructions
Divide the first number by the second number.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- server.py:88-93 (handler)The handler function for the 'divide' tool, decorated with @mcp.tool() for registration. It divides a by b, raising ValueError if b is 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
- server.py:88-88 (registration)Registration of the divide tool using the @mcp.tool() decorator.@mcp.tool()
- server.py:89-89 (schema)Input schema defined by type annotations: two float parameters a and b, returns float.def divide(a: float, b: float) -> float: