kodeagent.tools.calculator#
- kodeagent.tools.calculator(expression: str) float | None[source]#
Evaluate a single arithmetic expression and return the numeric result. Call this tool once per arithmetic operation. Do NOT try to compute multi-step problems in one call; chain multiple calls instead. Supported operators: +, -, , /, * (exponent), parentheses.
- Parameters:
expression – A single arithmetic expression, e.g. “7 + 5” or “12 * 4”. Use ** for exponents, not ^. Returns None for invalid input.
- Returns:
The numeric result as a float, or None if the expression is invalid.