Skip to main content
Glama

Agent Data Hub

Calculator: evaluate a math expression exactly

util_calc
Read-onlyIdempotent

Evaluate a math expression and get the exact number back, so the agent does not do arithmetic in its head. Supports + - * / % ^ (or **), parentheses, implicit multiplication (2pi), factorial (5!), constants pi, e, tau, phi, and functions sqrt, cbrt, abs, exp, ln, log (base 10), log2, sin/cos/tan (radians) and inverses, floor, ceil, round, min, max, pow, hypot. Optional named variables. Safe parser (no code execution); errors such as division by zero return 400 (not charged). Price: $0.001 per call (USDC on Base via x402); the first 10 calls per day are 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": "util_calc"
  }
}

Input Schema

NameRequiredDescriptionDefault
varsNoOptional variables, e.g. x=2,rate=0.05
precisionNoDecimal places to round to, 0–15 (default 12)
expressionYesMath expression, e.g. (1250*0.075)+sqrt(144)/3

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the read-only/idempotent annotations, the description discloses the parser is safe with no code execution, that errors such as division by zero return 400 and are not charged, and the cost model ($0.001/call, first 10 free daily). Cost and failure-charging behavior are exactly the kind of context annotations cannot convey.

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-loaded with purpose and capability list, then operational notes. The function enumeration is long but each item earns its place for callers constructing expressions; the pricing sentence is useful though slightly appended.

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 no output schema, the description must convey returns, and it does ('exact number back') plus error behavior. The exact serialized form (string vs numeric, and how precision affects it) is left implicit, which is the only notable omission for a tool this simple.

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%, so baseline is 3, and the description adds real meaning: the full operator/function grammar, implicit multiplication (2pi), radian-only trig, and that variables are 'optional named' with x=2 style. It does not clarify the precision parameter's interaction with exactness, which is a minor gap.

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 and resource ('Evaluate a math expression') plus the return intent ('get the exact number back'). This is clearly separable from siblings like util_units or util_date_calc, which handle conversion/date work rather than arbitrary expression evaluation.

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?

The clause 'so the agent does not do arithmetic in its head' gives clear context for when to reach for it instead of relying on internal computation. It stops short of explicit exclusions or naming alternatives, but the usage trigger is unambiguous.

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