CY
API & MCPDogfennaeth

Platfform Datblygwr Mariner GPS Tools

Trosi cyflymderau

Trosi rhwng clymau, milltiroedd yr awr, cilometrau yr awr, metrau yr eiliad a throedfeddi yr eiliad.

Rhyngwynebau

POST
Pwynt diwedd REST/api/v1/speed/convert
MCP
Enw offerynconvert_speed

Cais

Anfonwch y cais fel JSON. Mae cleientiaid MCP yn pasio'r un meysydd ag argumentau'r offeryn.

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"
}'
Corff y caisjson
{
  "value": 12,
  "from": "kn",
  "to": "kmh"
}

Ymateb

Mae REST yn amgáu canlyniad y cyfrifiad yn yr amlen lwyddiant safonol. Mae MCP yn dychwelyd yr un data cyfrifo fel allbwn offeryn strwythuredig.

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
  }
}

Sgemâu

Mae'r diffiniadau isod yn dangos y JSON Schema cyflawn a ddefnyddir i ddilysu mewnbynnau a disgrifio allbynnau.

Cynllun mewnbwn

{
  "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"
  ]
}

Cynllun allbwn

{
  "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"
  ]
}
Dogfennaeth API & MCP