{
  "name": "math.eval",
  "group": "compute",
  "summary": "Evaluate a mathematical expression exactly.",
  "description": "Evaluates arithmetic with correct operator precedence, parentheses, exponentiation, factorials, named variables and 30+ functions. Language models perform arithmetic by pattern-matching and quietly get long multiplications and compounding wrong; this computes the number instead of predicting it.",
  "keywords": [
    "calculator",
    "evaluate expression",
    "arithmetic",
    "compound interest",
    "math",
    "percentage"
  ],
  "endpoint": "https://fluentedi.com/v1/math/eval",
  "mcp_name": "math_eval",
  "makes_network_request": false,
  "parameters": {
    "type": "object",
    "properties": {
      "expression": {
        "description": "Expression to evaluate, e.g. \"(1+0.07)^30 * 1000\".",
        "type": "string",
        "maxLength": 2000,
        "examples": [
          "sqrt(2) * 10^3"
        ]
      },
      "variables": {
        "description": "Named values usable in the expression, e.g. {\"rate\": 0.07}.",
        "type": "object",
        "default": {}
      },
      "precision": {
        "description": "Decimal places to round the formatted result to.",
        "type": "integer",
        "default": 10,
        "minimum": 0,
        "maximum": 15
      }
    },
    "required": [
      "expression"
    ],
    "additionalProperties": false
  },
  "examples": [
    {
      "description": "Order of operations",
      "url": "https://fluentedi.com/v1/math/eval?expression=2%20%2B%203%20*%204%20%5E%202",
      "args": {
        "expression": "2 + 3 * 4 ^ 2"
      }
    },
    {
      "description": "Compound interest over 30 years",
      "url": "https://fluentedi.com/v1/math/eval?expression=principal%20*%20(1%20%2B%20rate)%20%5E%20years&variables=%7B%22principal%22%3A1000%2C%22rate%22%3A0.07%2C%22years%22%3A30%7D",
      "args": {
        "expression": "principal * (1 + rate) ^ years",
        "variables": {
          "principal": 1000,
          "rate": 0.07,
          "years": 30
        }
      }
    },
    {
      "description": "Functions and constants",
      "url": "https://fluentedi.com/v1/math/eval?expression=hypot(3%2C%204)%20%2B%20log10(1000)%20%2B%20pi",
      "args": {
        "expression": "hypot(3, 4) + log10(1000) + pi"
      }
    }
  ],
  "suggestion": null
}