calculate
Evaluates a mathematical expression deterministically. The agent should call this for any numeric calculation rather than computing in its head — this is the platform’s primary defence against arithmetic hallucinations. A safe, deterministic expression evaluator (using mathjs syntax) restricted to the operators, functions, constants, unit conversions, and percentages listed below. Code execution, imports, and symbolic operations are not available.Parameters
Supported:
- Operators:
+,-,*,/,^,%, parentheses - Functions:
sqrt,log,log2,log10,sin,cos,tan,abs,round,floor,ceil,min,max, factorial (!) - Constants:
pi,e - Unit conversions:
"5 km to miles","32 degF to degC","1.5 hours to minutes" - Percentages:
"15% of 4200"or"4200 * 15%"
Returns
result_type is one of "number", "unit", "string", "boolean", "object".
On failure:
Call from your own custom tool
Notes
- Evaluation is bounded by a 1-second wall-clock deadline.
- Division by zero,
logof non-positive, andsqrtof negative all return an error envelope (NaN/undefined are treated as failure). - Always registered.