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.
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 |
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: