Platforma agentów i API Road User Tools
Oblicz czas podróży
Oblicz czas podróży na podstawie odległości i średniej prędkości.
Interfejsy
POST
Punkt końcowy REST
/api/v1/journey-timeMCP
Nazwa narzędzia
calculate_journey_timeŻądanie
Wyślij żądanie jako JSON. Klienci MCP przekazują te same pola, co argumenty narzędzi.
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"
}
}'Treść żądaniajson
{
"distance": {
"value": 250,
"unit": "km"
},
"speed": {
"value": 100,
"unit": "kmh"
}
}Odpowiedź
REST zawija wynik obliczeń w standardową kopertę sukcesu. MCP zwraca te same dane obliczeniowe, co dane wyjściowe narzędzia strukturalnego.
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."
}
}Schematy
Poniższe definicje przedstawiają kompletny schemat JSON używany do sprawdzania poprawności wejść i opisywania wyjść.
Schemat wejścia
{
"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"
]
}Schemat wyjścia
{
"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"
]
}