Skip to main content
Glama

calculator

Evaluate mathematical and scientific expressions safely with an isolated AST evaluator to obtain exact numeric results and prevent arithmetic errors.

Instructions

Safely evaluate mathematical and scientific expressions using an isolated AST evaluator without unsafe execution. Supports arithmetic (+, -, *, /, **), trigonometry (sin, cos, tan), logarithms, square roots, and factorials. Use whenever exact numeric precision is required to avoid arithmetic hallucinations. Pure, deterministic, and idempotent.

Input Schema

NameRequiredDescriptionDefault
expressionYesThe mathematical expression string to evaluate (e.g. 'sqrt(144) + 15 * log(100)').

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.3
    • changedInput schema / properties / expression / description
      Previous value: -"Math expression (e.g. 'sqrt(144)', 'sin(pi/2)')"New value: +"The mathematical expression string to evaluate (e.g. 'sqrt(144) + 15 * log(100)')."
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden and does well: it discloses the isolated AST evaluator, the no-unsafe-execution model, and that the tool is pure, deterministic, and idempotent. It stops short of describing error behavior for malformed expressions, 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?

Three compact sentences, front-loaded with purpose and the safety claim, then capabilities, then the usage trigger. There is slight redundancy between 'Safely...without unsafe execution' and 'Pure, deterministic, and idempotent', but nothing meaningfully wasteful.

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?

For a single-parameter pure tool with no annotations and no output schema, the description covers purpose, supported operations, safety model, and when to call it. A brief note on the return value or error handling would round it out.

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

Parameters3/5

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

Schema coverage is 100% and the single expression parameter is documented with an example, so the schema does most of the work. The description adds value by listing supported functions (sin, cos, tan, log, sqrt, factorial) that indicate valid expression syntax, but no format or quoting rules.

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 (mathematical and scientific expressions), and enumerates supported operations. It is clearly distinguishable from siblings like web_search or summarize, which cannot perform exact arithmetic.

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 explicit when-to-use guidance: 'Use whenever exact numeric precision is required to avoid arithmetic hallucinations.' No exclusions or named alternatives, but no sibling is a plausible substitute for arithmetic evaluation, so the routing guidance is sufficient.

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