Skip to main content
Glama

Calculate

calculate
Read-onlyIdempotent

Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives. One expression per call. Supports arithmetic, trigonometry, statistics, matrices, complex numbers, units, and combinatorics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeNoVariable assignments for the expression. Example: { "x": 5, "y": 3 } makes "x + y" evaluate to 8.
variableNoVariable to differentiate with respect to. Required when operation is "derivative". Empty string is treated as omitted. Example: "x".
operationNoOperation to perform. "evaluate" computes a numeric result (default). "simplify" reduces an algebraic expression symbolically (e.g., "2x + 3x" -> "5 * x"). Supports algebraic and trigonometric identities. When the simplifier cannot reduce the expression further (e.g. rational expressions requiring polynomial factoring), the result is returned unchanged and unchanged: true is set in the output. "derivative" computes the symbolic derivative (requires the variable parameter).evaluate
precisionNoSignificant digits (1–16) for numeric results. Omit for full precision. Empty string is treated as omitted. Ignored for symbolic operations (simplify, derivative).
expressionYesOne mathematical expression per call — neither `;` nor newlines separate statements. Inside matrices, `;` separates rows (e.g. `[1, 2; 3, 4]`). Supports arithmetic (+, -, *, /, ^, %), functions across arithmetic/trig (sin, cos, sqrt, log, abs, round), statistics (mean, median, std, variance), combinatorics (factorial, permutations, combinations), and matrix (det, inv, transpose), plus constants (pi, e, phi, i), units (5 kg to lbs), and variables (when scope is provided). Standard notation `ln` and `arc*` (e.g. `arcsin`, `arctan`) is accepted alongside the math.js names `log` and `asin`/`atan`; common synonyms such as `stdev`, `permute`, `nCr`, and `length`/`len` resolve to their math.js names (`std`, `permutations`, `combinations`, `count`).
numericTypeNoNumeric type for evaluate. "number" (default): 64-bit IEEE 754 float — fastest, standard precision. "BigNumber": arbitrary-precision decimal — use when intermediate values overflow 64-bit float (e.g. large factorial ratios like 10000!/9999!); slower than "number". "Fraction": exact rational arithmetic — eliminates floating-point rounding (e.g. 0.1 + 0.2 = 0.3 exactly); limited to expressions with exactly-rational results — an irrational or transcendental result (sqrt, sin, log, …) fails with fraction_unsupported, so use "number" or "BigNumber" for those. Ignored for symbolic operations (simplify, derivative). When "number" evaluation produces a non-finite result (undefined_result error), retry with "BigNumber".number

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
resultNoThe computed result as a string.
operationNoThe operation that was applied.
scopeVarsNoKeys from the scope that were active during evaluation. Omitted when no scope was provided. Values are omitted to keep output compact.
unchangedNoPresent only for simplify operations. true means the simplifier returned the expression unchanged — it could not reduce it further (e.g. rational expressions requiring polynomial factoring are beyond math.js's built-in simplifier). false means simplification made progress. Omitted for evaluate and derivative.
expressionNoThe original expression as received.
resultTypeNoType of result as reported by math.js: number, BigNumber, Complex, DenseMatrix, Unit, string, boolean. Symbolic operations return "string".
precisionUsedNoSignificant-digit precision applied to the result. Omitted when full precision was used or the operation is symbolic.

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, indicating the tool does not mutate state. The description adds behavioral details: it exposes that simplify may return result unchanged with an 'unchanged: true' flag, that certain numeric types fail with 'fraction_unsupported' for irrational results, and that non-finite results suggest retrying with BigNumber. These insights go beyond annotations, providing transparency about edge cases and error handling. Minor gap: no explicit statement about side effects, but annotations cover that.

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?

The description is concise, with key operations stated upfront in a single sentence, then expanded in the expression parameter. Each sentence adds essential information without fluff. While the parameter descriptions are long, they are necessary due to the tool's complexity and are well-structured. The main description could be slightly tighter, but the overall structure is effective.

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?

The output schema is present, so the description doesn't need to detail the return structure. However, the description does mention specific output fields like 'unchanged: true' and error types, which adds context. With 6 parameters, all fully described, and behavioral details covered, the tool is well-specified. The only minor gap is that the tool's overall output shape is not described, but that is covered by the output schema, so this is adequate.

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 description coverage is 100%, so the schema fully documents each parameter, including detailed descriptions for operation, numericType, variable, and expression. The description adds further value by clarifying the meaning of expression syntax, listing supported functions and synonyms, and explaining the interaction between numericType and operations. The variable parameter's role in derivatives is clear. The only slight shortfall is not explicitly reiterating scope's purpose, but the schema already covers it with examples. Overall, the description complements the schema well.

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?

The description states a clear, specific purpose: 'Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives.' This distinguishes the three operations and uses precise verbs. Since there are no sibling tools, no further differentiation is needed, but the description provides a clear high-level overview of what the tool does.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use each operation: 'evaluate' for numeric results, 'simplify' for symbolic reduction, 'derivative' for symbolic derivatives. It also specifies constraints like 'One expression per call' and notes when the simplifier might return unchanged results. There are no alternatives to compare, but the guidance is clear and complete.

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.

TDQS

A4.4/5.0
Disambiguation5/5

With only a single tool, there is no possibility of ambiguity or misselection between tools. The tool's purpose is clearly stated, and it handles a wide range of mathematical operations without competing with any other tool.

Naming Consistency5/5

The only tool is named 'calculate', which is a clear, actionable verb. Since there is only one tool, there is no inconsistent naming pattern to evaluate, and the name accurately reflects its function.

Tool Count3/5

The server contains a single tool, which feels thin for a general-purpose calculator server that claims to support many domains (arithmetic, trigonometry, statistics, matrices, etc.). However, the tool is not trivial; it consolidates numerous capabilities into one entry point, which is borderline acceptable.

Completeness4/5

The tool appears to cover a broad range of mathematical operations including arithmetic, trig, statistics, matrices, complex numbers, units, and combinatorics. While it might lack advanced CAS features like integration or limits, for a calculator-focused server, the coverage is quite comprehensive and no critical gaps are evident.