Skip to main content
Glama

safe_calculator

Evaluates mathematical expressions with strict input validation, serving as a reference for secure calculation in an intentionally vulnerable MCP environment.

Instructions

A securely implemented calculator that safely evaluates mathematical expressions. Reference implementation for secure tools.

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

Input Schema

NameRequiredDescriptionDefault
expressionYesMathematical expression to evaluate (e.g., "2 + 2 * 3")

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/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 of behavioral disclosure, and it does not meet it. Claiming "securely implemented" and "safely evaluates" is unsubstantiated marketing language: it does not say what operators are supported, how errors are surfaced, what the return type is, or what "secure" concretely means (sandboxing, no eval, etc.).

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?

The first sentence is front-loaded and efficient. The second sentence ("Reference implementation for secure tools") is filler from the caller's perspective and does not help an agent decide or invoke, so the definition is not entirely waste-free.

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

Completeness3/5

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

This is a simple single-parameter tool with no output schema, so the description need not explain return values at length. Still, it omits the return type and error behavior, both of which an agent needs to chain a calculator call correctly, leaving it only minimally adequate.

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 parameter has a description plus a regex pattern constraining allowed characters, so the schema already does the explanatory work. The prose adds nothing about expression syntax beyond what the schema states, which is the baseline expectation for a one-parameter tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource: it "evaluates mathematical expressions." An agent can tell this is an arithmetic evaluation tool. However, it offers no differentiation from siblings like "calculate" or "helpful_calculator," which appear to serve the same purpose.

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool versus the other calculator tools in the catalog. The phrase "Reference implementation for secure tools" describes the tool's provenance, not a condition for selecting it, so the agent is left to infer usage entirely.

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