Skip to main content
Glama

calc

Read-only

Evaluates exact arithmetic expressions with fractions, big integers, variables, functions, and percentages to prevent rounding and mental-math errors.

Instructions

Exact calculator; use instead of mental math. Fractions and big integers exact (0.1+0.2=0.3, 100!), floats only for irrational results (marked). Ops + - * / ^ % (mod; postfix = percent: 200*19%) ! ; implicit 2pi; 0xff 1e3 1_000; vars "r=2; pi r^2", ans. Fns sqrt cbrt root(x,n) abs sign floor ceil trunc round(x,d) min max mod gcd lcm fact nCr nPr exp ln log(x,base=10) log2 sin cos tan asin acos atan atan2 sinh cosh tanh hypot; consts pi e tau phi deg (sin(30deg)).

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": "calc"
  }
}

Input Schema

NameRequiredDescriptionDefault
digitsNosignificant digits, default 30
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.2

TDQS

A4.3/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, so the description carries most of the load, and it does: exact rational/big-integer arithmetic, floats flagged as approximations, and postfix-percent semantics. It says nothing about error behavior (division by zero, parse failures) or the size/format of the returned value, which keeps it below 5.

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 exactness guarantee before the dense syntax reference, and every clause is functional reference material rather than filler. The run-on grammar block is hard to scan, but for a DSL tool the density is justified.

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 only two parameters and no output schema, the definition supplies enough — grammar, functions, constants, exactness guarantees — for an agent to construct correct expressions on the first try. The gaps are error semantics and how 'digits' interacts with the output, which matter less for a pure read-only evaluator.

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 only 50%: 'digits' is documented in the schema, but 'expression' has no schema description at all. The description compensates heavily by specifying the full expression grammar — operators, precedence-relevant notation like '2pi', numeric literals (0xff, 1e3, 1_000), variables, 'ans', the function list, and constants with degree syntax. It still never ties any of this to the 'digits' parameter.

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?

Opens with a specific verb-resource pair ('Exact calculator') plus the exact intent ('use instead of mental math'), which separates it cleanly from siblings like benchmark, convert_units and number_theory that could otherwise be mistaken for math 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?

'use instead of mental math' is an explicit usage directive, and 'floats only for irrational results (marked)' tells the agent when a float result is expected. It gives clear context but never names an alternative tool or a when-not-to-use case, so it falls 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.