← All tool references

Math · execute

Fraction Calculator

Add, subtract, multiply, or divide two fractions and inspect the reduced, mixed-number, and decimal forms.

Open public tool

Overview

Category
Math
API mode
execute
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/fraction-calculator

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/fraction-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

a_num · integer · required
First numerator.
a_den · integer · required
First non-zero denominator.
operation · string · required
Arithmetic operation. Accepted values: add, subtract, multiply, divide.
b_num · integer · required
Second numerator.
b_den · integer · required
Second non-zero denominator.
{
    "type": "object",
    "properties": {
        "a_num": {
            "type": "integer",
            "description": "First numerator."
        },
        "a_den": {
            "type": "integer",
            "description": "First non-zero denominator."
        },
        "operation": {
            "type": "string",
            "enum": [
                "add",
                "subtract",
                "multiply",
                "divide"
            ],
            "description": "Arithmetic operation."
        },
        "b_num": {
            "type": "integer",
            "description": "Second numerator."
        },
        "b_den": {
            "type": "integer",
            "description": "Second non-zero denominator."
        }
    },
    "required": [
        "a_num",
        "a_den",
        "operation",
        "b_num",
        "b_den"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

numerator · number
Reduced numerator.
denominator · number
Reduced denominator.
decimal · number
Decimal approximation.
display · string
Reduced fraction string.
mixed_number · string
Mixed-number representation.
{
    "type": "object",
    "properties": {
        "numerator": {
            "type": "number",
            "description": "Reduced numerator."
        },
        "denominator": {
            "type": "number",
            "description": "Reduced denominator."
        },
        "decimal": {
            "type": "number",
            "description": "Decimal approximation."
        },
        "display": {
            "type": "string",
            "description": "Reduced fraction string."
        },
        "mixed_number": {
            "type": "string",
            "description": "Mixed-number representation."
        }
    },
    "additionalProperties": false
}

One half plus one third

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/fraction-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "a_num": 1,
    "a_den": 2,
    "operation": "add",
    "b_num": 1,
    "b_den": 3
}'
{
    "ok": true,
    "data": {
        "slug": "fraction-calculator",
        "result": {
            "values": {
                "numerator": 5,
                "denominator": 6,
                "decimal": 0.83333332999999998325080241556861437857151031494140625,
                "display": "5/6",
                "mixed_number": "5/6"
            },
            "display": {
                "display": "5"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.