Skip to main content
Glama

calculator

Evaluates mathematical expressions using basic operators, parentheses, signs, and exponentiation, then returns the result or an error message.

Instructions

安全的数学计算器,支持加减乘除、括号、正负号、幂运算 示例:calculator(expression="(10+5)*2/3 - 4^2")

Args: expression: 合法的数学表达式字符串,仅支持数字和基础运算符 Returns: 计算结果或错误提示

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

Input Schema

NameRequiredDescriptionDefault
expressionYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full behavioral burden. It discloses an input constraint, only digits and basic operators, and that the tool returns either a result or an error, but 'safe' (安全) is asserted without explaining what safety means (sandboxing, step limits, or precision rules), and nothing is said about how large inputs are handled.

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 short and front-loads the capability before the example and the Args/Returns block. The example earns its place, and no sentence is redundant.

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 one-parameter tool with an output schema, the description covers the input format, supported grammar, an example, and the shape of the outcome. The remaining ambiguity is the unexplained 'safe' claim, which is minor given the tool's simplicity.

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 0%, so the description must explain the single parameter, and it does: a valid math expression string restricted to numbers and basic operators, reinforced by a concrete example. The phrase '仅支持数字和基础运算符' sits slightly awkwardly beside the advertised exponentiation support, although the example resolves it.

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 resource, a calculator, and enumerates the operations it handles (addition, subtraction, multiplication, division, parentheses, sign, exponentiation). It omits nothing crucial about the tool's purpose, although it does not explicitly distinguish itself from its siblings, which are unrelated, so that matters less.

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

Usage Guidelines3/5

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

Usage is only implied: the name, the operation list, and the example make clear that the tool evaluates math expressions, but the description never states when to prefer it over doing arithmetic mentally or over a sibling tool. No exclusions or prerequisites are given.

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

Deploy Server

Other Tools