Volume unit convert
volume-unit-convert · version 1.0.0 · Units & sizes · free, no key needed
Convert exact decimal volumes among SI, cubic, US liquid, and imperial units with explicit half-even rounding.
Use when you need to: convert volume units exactly · liters to US gallons · imperial gallons to liters.
Decide before calling
Read the versioned contract and the supported scope below. Reuse volume-unit-convert@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use volume-unit-convert@1.0.0 for convert volume units exactly. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- convert volume units exactly
- liters to US gallons
- imperial gallons to liters
- convert cubic feet to cubic meters
- US fluid ounces to milliliters
- compare US and imperial gallons
- exact cubic inch volume conversion
Not supported
- convert mass or weight units
- convert dry-volume or cooking-cup units
- infer units from free-form text
Behavior
- Input value is a canonical signed base-10 decimal string without exponent notation or redundant leading zeros.
- Factors are exact rational liters per unit: the international inch is exactly 25.4 mm, the US liquid gallon is 231 cubic inches, and the imperial gallon is 4.54609 liters.
- US liquid and imperial gallons, quarts, pints, and fluid ounces are distinct units and are never aliases.
- exact_fraction is reduced; value uses integer round-half-to-even at optional precision 0..50 (default 18), then removes trailing fractional zeros and negative zero.
- All validation and arithmetic are synchronous, bounded, locale-independent, offline, and deterministic.
Input
value(string, required): min length 1; max length 100; pattern^[+-]?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$from_unit(one of "milliliter", "liter", "cubic_centimeter", "cubic_meter", "cubic_inch", "cubic_foot", "us_fluid_ounce", "us_pint", "us_quart", "us_gallon", "imperial_fluid_ounce", "imperial_pint", "imperial_quart", "imperial_gallon", required)to_unit(one of "milliliter", "liter", "cubic_centimeter", "cubic_meter", "cubic_inch", "cubic_foot", "us_fluid_ounce", "us_pint", "us_quart", "us_gallon", "imperial_fluid_ounce", "imperial_pint", "imperial_quart", "imperial_gallon", required)precision(integer, optional): min 0; max 50
Output
value(string, required): min length 1; max length 256; pattern^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$exact_fraction(string, required): min length 3; max length 512; pattern^-?(?:0|[1-9][0-9]*)/[1-9][0-9]*$from_unit(one of "milliliter", "liter", "cubic_centimeter", "cubic_meter", "cubic_inch", "cubic_foot", "us_fluid_ounce", "us_pint", "us_quart", "us_gallon", "imperial_fluid_ounce", "imperial_pint", "imperial_quart", "imperial_gallon", required)to_unit(one of "milliliter", "liter", "cubic_centimeter", "cubic_meter", "cubic_inch", "cubic_foot", "us_fluid_ounce", "us_pint", "us_quart", "us_gallon", "imperial_fluid_ounce", "imperial_pint", "imperial_quart", "imperial_gallon", required)
Limits
- max input bytes: 256
- max value chars: 100
- max precision: 50
- max output bytes: 1024
Example
Request input:
{
"value": "1",
"from_unit": "us_gallon",
"to_unit": "liter"
}
Response:
{
"result": {
"value": "3.785411784",
"exact_fraction": "473176473/125000000",
"from_unit": "us_gallon",
"to_unit": "liter"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "volume-unit-convert",
"version": "1.0.0",
"input": {
"value": "1",
"from_unit": "us_gallon",
"to_unit": "liter"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/volume-unit-convert/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"value":"1","from_unit":"us_gallon","to_unit":"liter"}'
The machine-readable contract is at /v1/tools/volume-unit-convert/versions/1.0.0.
CLI
node cli.mjs run volume-unit-convert 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Area unit convert: Convert an exact decimal area among ten SI, imperial, acre, and hectare units using pinned rational factors.
- Pressure unit convert: Convert exact decimal pressure values among seven units and return a reduced exact fraction.
- Speed unit convert: Convert an exact decimal speed among metres per second, kilometres per hour, mph, knots, and feet per second.
- Byte size convert: Convert a non-negative integer byte size between IEC binary units as an exact rational.
- Byte size compare: Compare two non-negative integer byte sizes by exact byte amounts.
- Length convert: Convert a canonical integer length between exact SI and international customary units.