Math calculator
Use this when customers ask for calculations (totals, percentages, simple formulas). The agent sends the expression to the public mathjs API and returns the result.
What this tool does
Language models are good at conversation but can slip on arithmetic, especially with percentages, discounts and multi-item totals. This tool hands the calculation to the mathjs API, which returns an exact result that your agent then puts into a friendly reply. Your agent decides when to use it: whenever a customer asks for a total, a split, a discount or a monthly cost, it builds the expression, sends it and quotes the answer. Nothing is stored and no key is needed.
Example conversation
Customer
If I book 3 sessions at $85 and use the 15% returning client discount, what do I pay?
Tool callevaluate_math
expression: 3 * 85 * (1 - 0.15)
AI agent
Let me work that out. 3 × $85 is $255, and 15% off brings it to $216.75.
Customer
And if I split it over 3 months?
AI agent
That would be $72.25 a month. Would you like me to book the first session?
Example only. Tool calls are shown so you can see when the agent uses this template. Your agent’s wording depends on your prompt and business information.
Who uses it
- Clinics and salons quoting package prices with a discount or deposit applied.
- Home service businesses adding up materials, labour and call-out fees for a rough quote.
- Tutors and coaches working out monthly costs for a set number of lessons.
Setup
- Open Create agent or Edit agent and add a custom tool.
- Copy the fields below into the form. No API key is required.
- Optionally mention evaluate_math in your prompt when the customer needs a calculation.
Copy into custom tool form
Copy each value into the matching field when you add a custom tool on the create or edit agent page. Replace any YOUR_… placeholders with your real credentials.
Tool name
Description
Endpoint URL
Paste into Endpoint URL (https:// is added automatically).
HTTP method
Tool inputs (all)
Tool input: expression
Input name
Input type
Input description
Reference value
Use this as the request query or body value and choose “Tool input” in the form.
Request query (all)
Field name
Field value
