Road User Tools エージェント & API プラットフォーム
所要時間を計算
距離と平均速度から移動の所要時間を計算します。
インターフェース
POST
REST エンドポイント
/api/v1/journey-timeMCP
ツール名
calculate_journey_timeリクエスト
リクエストを JSON として送信します。 MCP クライアントは、同じフィールドをツール引数として渡します。
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"
}
}'リクエストボディjson
{
"distance": {
"value": 250,
"unit": "km"
},
"speed": {
"value": 100,
"unit": "kmh"
}
}応答
REST は、計算結果を標準の成功エンベロープにラップします。 MCP は、構造化ツールの出力と同じ計算データを返します。
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."
}
}スキーマ
以下の定義は、入力の検証と出力の説明に使用される完全な JSON スキーマを示しています。
入力スキーマ
{
"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"
]
}出力スキーマ
{
"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"
]
}