divide
Compute the quotient of two numbers a and b. Returns a divided by b.
Instructions
Divide a by b
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- calculator_server/server.py:196-201 (handler)The divide function is registered as an MCP tool via the @mcp.tool() decorator. It takes two floats a and b, raises ValueError if b is zero (to prevent division by zero), and returns a divided by b.
@mcp.tool() def divide(a: float, b: float) -> float: """Divide a by b""" if b == 0: raise ValueError("Cannot divide by zero") return a / b - calculator_server/server.py:196-196 (registration)The @mcp.tool() decorator registers the divide function as an MCP tool on the FastMCP instance.
@mcp.tool()