square_root
Calculate the square root of a number to solve mathematical problems or verify calculations. Enter a numeric value to get its square root result.
Instructions
Calculate the square root of a number.
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": {
"x": "<x>"
},
"name": "square_root"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes |
Implementation Reference
- server.py:100-105 (handler)The handler function for the 'square_root' tool. It takes a float input 'x', validates that it is non-negative, and returns the square root using math.sqrt. Registered via the @mcp.tool() decorator.
@mcp.tool() def square_root(x: float) -> float: """Calculate the square root of a number.""" if x < 0: raise ValueError("Cannot calculate square root of negative number") return math.sqrt(x)