divide
Perform floating-point division for two numbers using this tool. Input values 'a' (dividend) and 'b' (divisor) to calculate the result. Ensure 'b' is non-zero for accurate division.
Instructions
执行浮点数除法运算 Args: b: 除数(必须非零)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| a | Yes | ||
| b | Yes |
Implementation Reference
- calculator.py:22-30 (handler)The divide tool handler: decorated with @mcp.tool(), performs a / b after checking b != 0.@mcp.tool() def divide(a: float, b: float) -> float: """执行浮点数除法运算 Args: b: 除数(必须非零) """ if b == 0: raise ValueError("除数不能为零") return a / b
- calculator.py:22-22 (registration)Registers the divide function as an MCP tool.@mcp.tool()