Overview
Calculator tool for performing mathematical calculations including basic arithmetic, scientific functions, and expression evaluation. The user asks a math question; the agent evaluates the expression with the calculator and returns the result.Installation
Quick Start
1
Simple Usage
2
With Configuration
Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.
Usage with Agent
Available Methods
calculate(expression)
Evaluate a mathematical expression.Scientific Functions
Function-Based Usage
CLI Usage
Supported Operations
Supported Functions
sin,cos,tan- Trigonometricasin,acos,atan- Inverse trigonometricsqrt- Square rootlog,log10- Logarithmsexp- Exponentialabs- Absolute valueround,floor,ceil- Rounding
Error Handling
Common Errors
How It Works
Best Practices
Prefer the calculator over the LLM for math
Prefer the calculator over the LLM for math
LLMs approximate arithmetic. Route numeric work through the calculator tool for exact answers.
Guard against division by zero
Guard against division by zero
Wrap
calculate in error handling so a bad expression returns a message instead of crashing the agent.Use parentheses for clarity
Use parentheses for clarity
Explicit parentheses make the agent’s intended order of operations unambiguous.
Related Tools
Python
Execute Python code
Pandas
Data analysis

