Length convert
length-convert · version 1.0.0 · Units & sizes · free, no key needed
Convert a canonical integer length between exact SI and international customary units.
Use when you need to: length convert · convert length units · convert integer length between units.
Decide before calling
Read the versioned contract and the supported scope below. Reuse length-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 length-convert@1.0.0 for length convert. 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
- length convert
- convert length units
- convert integer length between units
Not supported
- nautical miles
- survey feet
- SI prefixes other than nm um mm cm m km
- floating-point lengths
Behavior
- value is a canonical integer string amount in the from unit and may be negative.
- from and to are exactly one of nm, um, mm, cm, m, km, in, ft, yd, mi using the LENGTH_NM table.
- The result is the reduced rational (value * from_nm) / to_nm expressed in to units.
- Sign lives only on the numerator; zero is numerator 0 over denominator 1.
- Input integers and the reduced numerator and denominator may have at most 1000 digits excluding sign.
Input
value(string, required): max length 1001; pattern^-?(0|[1-9][0-9]*)$from(one of "nm", "um", "mm", "cm", "m", "km", "in", "ft", "yd", "mi", required)to(one of "nm", "um", "mm", "cm", "m", "km", "in", "ft", "yd", "mi", required)
Output
numerator(string, required): pattern^(0|-?[1-9][0-9]*)$denominator(string, required): pattern^[1-9][0-9]*$
Limits
- max digits: 1000
- units: ["nm","um","mm","cm","m","km","in","ft","yd","mi"]
Example
Request input:
{
"value": "1",
"from": "ft",
"to": "in"
}
Response:
{
"result": {
"numerator": "12",
"denominator": "1"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "length-convert",
"version": "1.0.0",
"input": {
"value": "1",
"from": "ft",
"to": "in"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/length-convert/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"value":"1","from":"ft","to":"in"}'
The machine-readable contract is at /v1/tools/length-convert/versions/1.0.0.
CLI
node cli.mjs run length-convert 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Css length convert: Convert px, pt, pc, in, cm, mm, or Q using exact CSS ratios; returns a rounded decimal value.
- Uniaxial stress compute: Compute axial engineering stress and strain from unit-bearing force, area, elongation, and original length.
- Area unit convert: Convert an exact decimal area among ten SI, imperial, acre, and hectare units using pinned rational factors.
- Byte size convert: Convert a non-negative integer byte size between IEC binary units as an exact rational.
- Css px to rem: Convert px to rem or em with a supplied root or parent font size; returns an exactly rounded relative length.
- Css rem to px: Convert rem or em to px using a supplied root or parent font size; returns an exactly rounded pixel length.