Platforma programistyczna Mariner GPS Tools
Przelicz prędkości
Przelicz jednostki prędkości
Interfejsy
POST
Punkt końcowy REST
/api/v1/speed/convertMCP
Nazwa narzędzia
convert_speedŻądanie
Wyślij żądanie jako JSON. Klienci MCP przekazują te same pola, co argumenty narzędzi.
cURLshell
curl -X POST https://marinergps.tools/api/v1/speed/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"value": 12,
"from": "kn",
"to": "kmh"
}'Treść żądaniajson
{
"value": 12,
"from": "kn",
"to": "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": {
"input": {
"value": 12,
"from": "kn",
"to": "kmh"
},
"conversions": {
"kn": 12,
"mph": 13.80935337628251,
"kmh": 22.224,
"ms": 6.173333333333334,
"fts": 20.253718285214347
},
"result": 22.224
}
}{
"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": {
"value": {
"type": "number",
"description": "Speed value to convert."
},
"from": {
"type": "string",
"enum": [
"kn",
"mph",
"kmh",
"ms",
"fts"
],
"description": "Input speed unit."
},
"to": {
"type": "string",
"enum": [
"kn",
"mph",
"kmh",
"ms",
"fts"
],
"description": "Optional target unit. When omitted, all units are returned."
}
},
"required": [
"value",
"from"
]
}Schemat wyjścia
{
"type": "object",
"additionalProperties": false,
"properties": {
"input": {
"type": "object",
"additionalProperties": false,
"properties": {
"value": {
"type": "number"
},
"from": {
"type": "string",
"enum": [
"kn",
"mph",
"kmh",
"ms",
"fts"
]
},
"to": {
"type": "string",
"enum": [
"kn",
"mph",
"kmh",
"ms",
"fts"
]
}
},
"required": [
"value",
"from"
]
},
"conversions": {
"type": "object",
"additionalProperties": false,
"properties": {
"kn": {
"type": "number"
},
"mph": {
"type": "number"
},
"kmh": {
"type": "number"
},
"ms": {
"type": "number"
},
"fts": {
"type": "number"
}
},
"required": [
"kn",
"mph",
"kmh",
"ms",
"fts"
]
},
"result": {
"type": "number",
"description": "Target-unit result when a target unit is supplied."
}
},
"required": [
"input",
"conversions"
]
}