Math & Statistics Calculator API for AI Agents
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Math & Statistics Calculator API for AI Agents
Stop letting your LLM guess numbers. This Actor evaluates math expressions safely and computes basic statistics for a list of numbers, deterministically, in one call. It works as a normal Apify Actor (API, schedules, integrations) and also as an MCP server so AI agents can call it as a tool.
What it does
Expression evaluation: arithmetic (
+ - * / // % **), parentheses, constants (pi,e,tau) and functions (sqrt,sin,cos,tan,asin,acos,atan,log,log10,log2,exp,floor,ceil,abs,round,min,max,sum,factorial,gcd,radians,degrees,mean,median,stdev,variance). Expressions are parsed into a syntax tree and only a whitelist of numeric operations is executed. Pythonevalis never used.Statistics: count, sum, mean, median, mode, min, max, range, sample variance and standard deviation, population variance and standard deviation.
Floating point noise is rounded away (
0.1 + 0.2gives0.3), configurable withdecimals.
Related MCP server: mcp-math-tools
Input example
{
"expressions": ["(12.5 * 4) + sqrt(144)"],
"numbers": [2, 4, 4, 4, 5, 5, 7, 9],
"statistics": ["mean", "median", "mode", "pstdev"],
"decimals": 10
}Provide expressions, numbers, or both. statistics is optional (default: all).
Output example
[
{"type": "expression", "expression": "(12.5 * 4) + sqrt(144)", "result": 62},
{"type": "statistics", "mean": 5, "median": 4.5, "mode": [4], "pstdev": 2}
]mode is always a list because a data set can have several modes. variance and stdev are null when fewer than two numbers are given.
Pricing
US$0.002 per run (event: Calculation run), regardless of how many expressions or numbers are in the run.
Limits
Up to 1000 expressions per run, each up to 1000 characters.
Up to 100,000 numbers per run.
Integer bases and exponents in
**are capped at 10,000;factorialaccepts 0-1000; results larger than 1e300 are rejected.Use
**for powers.^is rejected to avoid silent XOR mistakes.Only numbers are supported (no strings, variables or complex numbers).
Invalid input (unknown function, division by zero, non-numeric result) stops the run with a clear error message.
Results are IEEE double precision, not arbitrary-precision decimals (except integer arithmetic, which is exact).
Credits
This Actor is built on the Python standard library (ast, math and statistics modules), distributed under the Python Software Foundation License. It does not wrap a third-party open-source project.
Hosted version: Apify Store · Docs: https://chunyunglo.github.io/afw-tools/math-statistics-calculator-api/
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Exact arithmetic and statistics for AI agents and apps. Evaluate math expressions safely and get...
1500+ deterministic tools for AI agents: math, conversion, validation, hashing, encoding, date/time.
Deterministic numeral verification for AI agents and documents (<20 ms, zero tokens).
Verifiable, deterministic risk math for autonomous agents; re-runnable proof on every answer.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables mathematical calculations through basic arithmetic operations including addition, subtraction, multiplication, division, exponentiation, and logarithms. Provides a simple interface for AI agents to perform mathematical computations.63-
- AlicenseAqualityDmaintenanceEnables safe math expression evaluation, unit conversion, statistical analysis, number formatting, and percentage calculations for AI agents via MCP.548 npmMIT
- AlicenseNot gradedqualityBmaintenanceProvides exact, deterministic tools for math, dates, units, validation, and more to AI agents, returning precise answers with explicit assumptions and warnings instead of model guesses.MIT
- AlicenseAqualityBmaintenanceProvides LLMs with deterministic math tools for sandboxed expression evaluation, descriptive statistics, primality testing, prime factorization, GCD/LCM, quadratic solving, and base conversion. Every operation runs real code rather than relying on the model's arithmetic, with expression parsing restricted to a whitelist of operators, constants, and functions.2111 PyPI1MIT