Road User Tools Agent & API Platform
Convert fuel economy
Convert between UK MPG, US MPG, litres per 100 kilometres, and kilometres per litre.
Interfaces
POST
REST endpoint
/api/v1/fuel-economy/convertMCP
Tool name
convert_fuel_economyRequest
Send the request as JSON. MCP clients pass the same fields as tool arguments.
cURLshell
curl -X POST https://roaduser.tools/api/v1/fuel-economy/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
}'Request bodyjson
{
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
}Response
REST wraps the calculation result in the standard success envelope. MCP returns the same calculation data as structured tool output.
JSON
{
"ok": true,
"data": {
"input": {
"value": 40,
"from": "mpg_uk",
"to": "l_per_100km"
},
"conversions": {
"mpg_uk": 40,
"mpg_us": 33.30696738515955,
"l_per_100km": 7.062023408295555,
"km_per_l": 14.160247597385885
},
"result": 7.062023408295555
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Schemas
The definitions below show the complete JSON Schema used to validate inputs and describe outputs.
Input schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number",
"description": "Fuel economy value to convert. Must be finite and greater than zero."
},
"from": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
],
"description": "Input fuel economy unit."
},
"to": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
],
"description": "Optional target unit. When omitted, all units are returned."
}
},
"required": [
"value",
"from"
]
}Output schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"input": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number"
},
"from": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
},
"to": {
"type": "string",
"enum": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"mpg_uk": {
"type": "number"
},
"mpg_us": {
"type": "number"
},
"l_per_100km": {
"type": "number"
},
"km_per_l": {
"type": "number"
}
},
"required": [
"mpg_uk",
"mpg_us",
"l_per_100km",
"km_per_l"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}