Skip to main content
Glama

Math expression calculator: evaluate a formula safely

math_evaluate
Read-only

Evaluate an arithmetic expression safely (parsed, never executed as code): + - * / % ^ and **, parentheses, factorial !, constants pi, e and tau, and functions sqrt, cbrt, abs, round, floor, ceil, exp, ln, log (base 10), log2, sin, cos, tan, asin, acos, atan (radians), min, max and pow. Up to 500 characters. Use when an agent needs exact arithmetic instead of guessing, for prices, unit maths or formulas. Example: expression=(1500 * 0.045 / 12) + sqrt(144) - 2^3. Price $0.01/call via x402 USDC or a card key (/credits), first 25 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

Input Schema

NameRequiredDescriptionDefault
expressionYesThe expression, such as (2+3)*4^2/sqrt(16)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds substantial behavior beyond the annotations: the parser is safe and never executes code, there is a 500-character limit, calls cost $0.01, the first 25 are free, failed calls are free, and repeats are not free. The readOnlyHint=true and destructiveHint=false annotations are consistent with 'reads or computes only and changes nothing'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads what the tool computes and what syntax it accepts, then follows with usage, an example, and pricing. Slightly redundant at the end ('each call is charged, so repeats are not free' repeats the $0.01/call point), but every part is relevant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is thorough on syntax, limits, and billing, but with no output schema it never states the return type or shape (e.g., a number vs. a formatted string, or how rounding is handled). That is a clear gap for a compute tool, though the rest of the entry is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema itself includes an example, so parameter semantics are already well served. The description adds useful meaning with the supported operator/function set and the 500-character constraint, which the schema does not state.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (evaluate) and resource (arithmetic expression) and enumerates exactly what the parser accepts: operators, constants, and named functions. This clearly separates it from siblings like math_stats, units_convert, and the calc_* helpers.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit usage condition ('when an agent needs exact arithmetic instead of guessing, for prices, unit maths or formulas') with a concrete example. It does not name the sibling tools an agent should prefer for statistics or unit conversion, but the context is otherwise clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.