eval_expression
Deterministically evaluates arithmetic, mathematical, and logical expressions inside an AST-isolated sandbox. Prevents LLM calculation errors while strictly blocking arbitrary code execution. Use for reliable numerical calculations and boolean logic. Do not use for executing arbitrary Python statements or importing external libraries.
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": {
"expression": "<expression>"
},
"name": "eval_expression"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | A valid mathematical, arithmetic, or boolean expression string (e.g. '((150 * 12) / 4) + 18.5'). |