Skip to main content
Glama

Mathematical Calculator

calc_expression
Read-onlyIdempotent

Evaluate mathematical expressions safely using basic operations and functions like sin, cos, sqrt, and log. Input a single expression to get the result.

Instructions

Safely evaluate mathematical expressions with support for basic operations and math functions.

Supported operations: +, -, *, /, **, () Supported functions: sin, cos, tan, log, sqrt, abs, pow

Note: Use this tool to evaluate a single mathematical expression. To compute descriptive statistics over a list of numbers, use the statistics tool instead.

Examples:

  • "2 + 3 * 4" → 14

  • "sqrt(16)" → 4.0

  • "sin(3.14159/2)" → 1.0

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesMathematical expression to evaluate. Supports +, -, *, /, **, and math functions (sin, cos, sqrt, log, etc.). Example: '2 * sin(pi/4) + sqrt(16)'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes
resultYes
difficultyYes
expressionYes
Behavior5/5

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

Adds 'safely' context beyond annotations, lists all operations and functions, and provides examples demonstrating behavior.

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?

Very concise: single line purpose, bulleted ops, clear usage note, and three diverse examples. No wasted words.

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 simple calculator: purpose, operations, parameter, usage guidance, examples. Annotations and output schema handle remaining context.

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 already provides good parameter description (100% coverage). Description adds constraint 'single mathematical expression' and usage context, adding value beyond schema.

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?

Clearly states 'evaluate mathematical expressions' with supported operations and functions. Distinguishes from siblings like calc_statistics.

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?

Explicitly states when to use (single expression) and when not (statistics), naming the alternative tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/clouatre-labs/math-mcp-learning-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server