divide
Compute the quotient of a divided by b. Raises an error if b equals zero to prevent division by zero.
Instructions
Divide a by b. Raises if b == 0.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The divide tool handler: divides a by b, raises ValueError if b is zero.
@mcp.tool() def divide(a: float, b: float) -> float: """Divide a by b. Raises if b == 0.""" if b == 0: raise ValueError("Division by zero is not allowed.") return a / b - src/mcp_research_collective/mcp_server.py:97-98 (registration)The @mcp.tool() decorator registers 'divide' as a FastMCP tool.
@mcp.tool() def divide(a: float, b: float) -> float: