← All tool references

Engineering · not_available

Mileage Calculator

Calculate fuel economy from distance traveled, fuel used, fuel price per unit.

Open public tool

Overview

Category
Engineering
API mode
not_available
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/mileage-calculator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/mileage-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.

distance · number · required
Enter distance traveled.
fuel_used · number · required
Enter fuel used.
fuel_price · number · required
Enter fuel price per unit.
{
    "type": "object",
    "properties": {
        "distance": {
            "type": "number",
            "description": "Enter distance traveled."
        },
        "fuel_used": {
            "type": "number",
            "description": "Enter fuel used."
        },
        "fuel_price": {
            "type": "number",
            "description": "Enter fuel price per unit."
        }
    },
    "required": [
        "distance",
        "fuel_used",
        "fuel_price"
    ],
    "additionalProperties": false
}

Output schema

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

fuel_economy · number
Fuel economy produced by the tool.
fuel_cost · number
Fuel cost produced by the tool.
cost_per_distance · number
Cost per distance produced by the tool.
{
    "type": "object",
    "properties": {
        "fuel_economy": {
            "type": "number",
            "description": "Fuel economy produced by the tool."
        },
        "fuel_cost": {
            "type": "number",
            "description": "Fuel cost produced by the tool."
        },
        "cost_per_distance": {
            "type": "number",
            "description": "Cost per distance produced by the tool."
        }
    },
    "additionalProperties": false
}

Mileage Calculator worked example

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/mileage-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "distance": 420,
    "fuel_used": 14,
    "fuel_price": 3.45000000000000017763568394002504646778106689453125
}'
{
    "ok": true,
    "data": {
        "slug": "mileage-calculator",
        "result": {
            "values": {
                "fuel_economy": 30,
                "fuel_cost": 48.2999999999999971578290569595992565155029296875,
                "cost_per_distance": 0.11500000000000000499600361081320443190634250640869140625
            },
            "display": {
                "display": "30"
            },
            "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.