divide
Divide two integer numbers to calculate quotients or split values. Input two numbers to perform division operations.
Instructions
Divide two numbers
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 |
Implementation Reference
- main.py:25-29 (handler)The handler function implementing the 'divide' tool logic: divides a by b after checking for division by zero.
def divide(a: int, b: int) -> float: """Divide two numbers""" if b == 0: raise ValueError("Cannot divide by zero") return a / b - main.py:24-24 (registration)The @mcp.tool decorator registers the divide function as an MCP tool.
@mcp.tool - main.py:25-26 (schema)Type annotations and docstring define the input schema (two ints) and output (float) for the tool.
def divide(a: int, b: int) -> float: """Divide two numbers"""