divide
Divide two integers to calculate the quotient. This tool performs basic division operations for mathematical calculations.
Instructions
Divide the first integer by the second.
Args: a: First integer (dividend) b: Second integer (divisor)
Returns: The quotient of a divided by b
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- main.py:44-57 (handler)The 'divide' tool handler function, decorated with @mcp.tool to register it as an MCP tool. Takes two integers (a, b) as input, validates that b is not zero, and returns the quotient as a float. The type hints (int, float) and docstring provide the schema for input/output validation.
@mcp.tool def divide(a: int, b: int) -> float: """Divide the first integer by the second. Args: a: First integer (dividend) b: Second integer (divisor) Returns: The quotient of a divided by b """ if b == 0: raise ValueError("Cannot divide by zero") return a / b - main.py:44-44 (registration)The @mcp.tool decorator registers the divide function as an MCP tool with the FastMCP framework.
@mcp.tool