Skip to main content
Glama

Agent Data Tools: Utilities

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 10 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "expression": "<expression>"
    },
    "name": "math_evaluate"
  }
}

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?

Beyond the annotations, the description discloses that parsing is safe and 'never executed as code', a 500-character input cap, and detailed cost behavior ($0.01/call, first 10 free, failed calls free, repeats not free) — consistent with idempotentHint=false. Those are exactly the operational facts an agent needs before calling a paid tool repeatedly.

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?

It is front-loaded with capability and syntax before pricing, and the worked example makes the format concrete. It is a single dense paragraph with some packing (pricing and the /credits aside), but nearly every clause carries actionable information.

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

Completeness4/5

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

With one parameter, no output schema, and read-only annotations, the description covers input syntax, safety, limits, and cost. The remaining gap is the return side: it never says the result is a number, its precision/rounding, or how errors surface (only that failed calls are free).

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

Parameters5/5

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

The schema only offers one terse sentence and an example, so the description carries the real semantics: the full operator set (+ - * / % ^ **, parentheses, !), constant names (pi, e, tau), the function inventory with the note that trig works in radians, and the 500-character limit. That is meaningful syntax information not present in the schema.

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

Purpose4/5

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

The description opens with a specific verb+resource ('Evaluate an arithmetic expression') and enumerates the exact supported syntax (operators, factorial, constants, functions), which is far beyond restating the title. It doesn't name a sibling such as math_stats, but the stated purpose ('exact arithmetic') is unambiguous enough that an agent can distinguish it without reading another schema.

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?

It gives explicit when-to-use guidance: 'Use when an agent needs exact arithmetic instead of guessing, for prices, unit maths or formulas,' and adds a worked example. It does not state exclusions or name an alternative tool for related numeric tasks (e.g. statistics), so it stops short of a 5.

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.

Resources