Skip to main content
Glama

calculate

Evaluate a math expression safely: + - * / // % **, parentheses, functions (abs round min max sqrt floor ceil exp log log2 log10 pow sin cos tan), constants pi e tau inf. Parsed to an AST and only whitelisted nodes are computed -- no eval(), no names, no arbitrary code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYese.g. "(1500 * 0.23) + 47"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

No annotations are provided, so the description carries full responsibility — and it delivers. It explicitly discloses the AST-based parsing, whitelisted-node computation, and the absence of eval(), names, and arbitrary code execution. This is exactly the kind of behavioral context an agent needs to trust the tool with unsanitized input, going well beyond what a typical description states.

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

Conciseness5/5

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

Two sentences with zero waste. The first front-loads purpose and supported features; the second delivers the safety model. Every clause earns its place, and the safety-critical detail is placed where it matters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Complete for a single-parameter calculator. The schema fully documents the expression parameter, the description enumerates the full supported language and safety semantics, and the return value (numeric result) is self-evident without an output schema. Nothing an agent needs to call it correctly is missing.

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% with a concrete example, but the description adds real semantic value by specifying the valid grammar: operators, function names, and constants accepted inside the expression string. This effectively documents the expression language beyond what the schema's single example conveys.

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?

Clear verb+resource: 'Evaluate a math expression'. Enumerates supported operators, functions, and constants, leaving no doubt about scope. The sibling tools (diff, generate_uuid, get_drift, get_time) are entirely unrelated, so no differentiation burden exists — the purpose is unambiguous on its own.

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 description clearly states its domain ('evaluate a math expression') and the supported grammar, which implicitly tells an agent when to reach for it. It stops short of explicit when-not-to-use exclusions, but with no relevant alternative among siblings (all unrelated utilities), explicit routing is unnecessary. The safety note further signals it's the right choice for untrusted input.

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