Skip to main content
Glama

Evaluar expresión matemática

expression-evaluate
Read-onlyIdempotent

Evalúa una expresión matemática con un analizador propio (sin eval): operadores, funciones, constantes y variables. Cuándo: un resultado numérico tiene que ser exacto o reproducible y no estimado. No para: realizar aritmética exacta de enteros grandes (bigint-calc). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Evaluates an arithmetic expression with its own parser (no eval): + − * / % ^ !, parentheses, implicit multiplication, functions (sqrt, sin, ln, log, min, max…), constants pi/e/tau/phi and named variables. When: a numeric result has to be exact or reproducible instead of estimated. Not for: computing the exact arbitrary-precision integer arithmetic (bigint-calc). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
decimalsNoRound result to N decimals (integer; optional; default 12; min 0; max 15).
variablesNoVariable values (object; optional; default {}).
expressionYesExpression (string; required; at least 1 chars; up to 2000 chars).

Output Schema

NameRequiredDescriptionDefault
resultNoany JSON value

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / expression / examples
      Added value: +[
      +  "2 + 3 * (4 - 1) ^ 2"
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Evaluates an arithmetic expression with its own parser (no eval): + − * / % ^ !, parentheses, implicit multiplication, functions (sqrt, sin, ln, log, min, max…), constants pi/e/tau/phi and named variables. When: a numeric result has to be exact or reproducible instead of estimated. Not for: computing the exact arbitrary-precision integer arithmetic (bigint-calc). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so safety is structured data. The description still earns credit for information not in annotations: it uses its own parser with no eval, is deterministic, and documents hard limits (64 KB JSON input, 1 s per call, 1 MB result). It does not describe error behavior on invalid expressions, which keeps it below a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Content is front-loaded with the core purpose first, but the field is effectively duplicated: a Spanish block, then an English block restating the same thing, then a third copy inside inputSchema.description. The redundant bilingual mirroring roughly doubles length without adding 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?

For a pure-computation tool with a full output schema and complete annotations, the description covers purpose, exclusions, purity, determinism and execution limits — everything needed to call it correctly. Minor gap: it does not say what a malformed expression or unknown function produces, though the output schema partially covers returns.

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 description coverage is 100%, so all three parameters (expression, variables, decimals) are already documented — the baseline is 3. The prose adds meaning for `variables` ('named variables' usable inside expressions) but says nothing about `decimals` rounding semantics or the 0–15 range beyond what the schema states, so it does not exceed the baseline.

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 an arithmetic expression) and enumerates the exact grammar surface: operators + − * / % ^ !, parentheses, implicit multiplication, functions like sqrt/sin/ln, constants pi/e/tau/phi and named variables. It also forecloses the closest sibling by name (bigint-calc), so an agent can discriminate without opening the schema.

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?

Explicit 'Cuándo: a numeric result has to be exact or reproducible instead of estimated' plus an explicit 'No para: exact arbitrary-precision integer arithmetic (bigint-calc)'. This is the when/when-not/alternative triad spelled out rather than left to inference.

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