Skip to main content
Glama

Fraction Calculator

calculate_fraction_arithmetic
Read-onlyIdempotent

Use this when you need an exact result of an operation on two fractions (e.g. 3/4 + 1/6), including mixed numbers such as 1 1/2, rather than a rounded decimal. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.

Do not use this when you only want to reduce a single fraction or convert it to a decimal or percent (use fraction-simplifier), or you need the least common denominator of several denominators (use gcd-lcm). What it computes: Adds, subtracts, multiplies or divides two fractions, mixed numbers, whole numbers or decimals with exact integer arithmetic, returning the result in lowest terms, as a mixed number and as a decimal, with the intermediate steps. Inputs: fraction_a (string); fraction_b (string); operation (enum, optional). Complete JSON argument examples: {"fraction_a":"3/4","fraction_b":"1/6","operation":"add"} | {"fraction_a":"2 1/3","fraction_b":"5/6","operation":"subtract"} Outputs: result, mixed_number, numerator, denominator, decimal, working. Formula: a/b + c/d = (a·(L/b) + c·(L/d)) / L with L = lcm(b, d), a/b − c/d likewise; a/b × c/d = (a·c) / (b·d); a/b ÷ c/d = (a·d) / (b·c); the result is divided by gcd(numerator, denominator) Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/fraction-arithmetic with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/math/fraction-arithmetic.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationNoOperation applied as fraction_a (operation) fraction_b.add
fraction_aYesFirst operand: a fraction '3/4', a mixed number '1 1/2' or '-1 1/2', a whole number '5' or a decimal '0.75'.
fraction_bYesSecond operand in the same formats.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linksNo
resultYes
requestYes
sourcesNo
successYes
versionNo
freshnessNo
timestampYes
next_actionsNo
service_versionYesDeployed Calcgrid implementation version used for the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / fraction_a / maxLength
      Added value: +40
    • addedInput schema / properties / fraction_b / maxLength
      Added value: +40
    • addedOutput schema / properties / service_version
      Added value: +{
      +  "description": "Deployed Calcgrid implementation version used for the result.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "success",
      -  "request",
      -  "result",
      -  "timestamp"
      -]New value: +[
      +  "success",
      +  "service_version",
      +  "request",
      +  "result",
      +  "timestamp"
      +]
  2. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "fraction_a": "3/4",
      +    "fraction_b": "1/6",
      +    "operation": "add"
      +  },
      +  {
      +    "fraction_a": "2 1/3",
      +    "fraction_b": "5/6",
      +    "operation": "subtract"
      +  }
      +]
  3. Added
  4. Removed
  5. First observed

TDQS

A4.8/5.0
Behavior5/5

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

The description discloses that it uses exact integer arithmetic, returns results in lowest terms, provides mixed-number and decimal forms, and includes intermediate steps. It also gives the underlying formula and a direct REST fallback. These go beyond the readOnlyHint and idempotentHint annotations and match them—no contradiction.

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 long, but it is well-structured with clear sections (Use when, Do not use, What it computes, Inputs, Examples, Outputs, Formula, REST fallback). The most important routing guidance is front-loaded, and every section earns its place for a reference tool. It is dense but not bloated.

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?

Given the tool has an output schema and the annotations already cover read-only/idempotent behavior, the description covers everything an agent needs: input formats, operation enum, output fields, formula, a direct REST fallback, and documentation link. Nothing critical is missing for correct invocation.

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?

The schema already describes all three parameters with 100% coverage, so the baseline is 3. The description adds value by spelling out accepted input formats (fractions, mixed numbers, whole numbers, decimals, negatives), providing two complete JSON examples, and explaining the operation semantics. It does not fully repeat the schema but does reinforce and expand on it.

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?

The description opens with a precise use-case ('exact result of an operation on two fractions, including mixed numbers') and names the specific resource and operation. It explicitly distinguishes itself from related tools like fraction-simplifier and gcd-lcm, so an agent can immediately tell this from sibling calculators.

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?

It provides explicit when-to-use ('Call this tool directly and return its calculation') and when-not-to-use guidance, naming alternative tools for reducing a fraction, converting to decimal/percent, and finding the LCD. It also warns against answering from memory, which is actionable for an agent.

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