Platform ng Agent at API ng Road User Tools
Kalkulahin ang oras ng paglalakbay
Kalkulahin ang tagal ng paglalakbay mula sa distansya at average na bilis.
Mga interface
POST
REST endpoint
/api/v1/journey-timeMCP
Pangalan ng tool
calculate_journey_timeKahilingan
Ipadala ang kahilingan bilang JSON. Ang mga kliyente ng MCP ay pumasa sa parehong mga field bilang mga argumento ng tool.
cURLshell
curl -X POST https://roaduser.tools/api/v1/journey-time \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"distance": {
"value": 250,
"unit": "km"
},
"speed": {
"value": 100,
"unit": "kmh"
}
}'Humiling ng katawanjson
{
"distance": {
"value": 250,
"unit": "km"
},
"speed": {
"value": 100,
"unit": "kmh"
}
}Tugon
Binabalot ng REST ang resulta ng pagkalkula sa karaniwang sobre ng tagumpay. Ibinabalik ng MCP ang parehong data ng pagkalkula bilang output ng structured tool.
JSON
{
"ok": true,
"data": {
"totalSeconds": 9000,
"totalHours": 2.5,
"duration": {
"hours": 2,
"minutes": 30,
"seconds": 0
},
"formatted": "2:30:00"
}
}{
"ok": false,
"error": {
"code": "invalid_request",
"message": "Invalid request input."
}
}Mga scheme
Ang mga kahulugan sa ibaba ay nagpapakita ng kumpletong JSON Schema na ginamit upang patunayan ang mga input at ilarawan ang mga output.
Input schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"distance": {
"type": "object",
"additionalProperties": false,
"description": "Journey distance. Must be finite and non-negative.",
"properties": {
"value": {
"type": "number"
},
"unit": {
"type": "string",
"enum": [
"km",
"mi",
"m"
]
}
},
"required": [
"value",
"unit"
]
},
"speed": {
"type": "object",
"additionalProperties": false,
"description": "Average speed. Must be finite and greater than zero.",
"properties": {
"value": {
"type": "number"
},
"unit": {
"type": "string",
"enum": [
"kmh",
"mph",
"ms",
"kn"
]
}
},
"required": [
"value",
"unit"
]
}
},
"required": [
"distance",
"speed"
]
}Output schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"totalSeconds": {
"type": "number",
"description": "Total duration in seconds, full precision."
},
"totalHours": {
"type": "number",
"description": "Total duration in decimal hours."
},
"duration": {
"type": "object",
"additionalProperties": false,
"description": "Duration split into whole hours, minutes, and seconds.",
"properties": {
"hours": {
"type": "number"
},
"minutes": {
"type": "number"
},
"seconds": {
"type": "number"
}
},
"required": [
"hours",
"minutes",
"seconds"
]
},
"formatted": {
"type": "string",
"description": "H:MM:SS presentation of the duration."
}
},
"required": [
"totalSeconds",
"totalHours",
"duration",
"formatted"
]
}