TL
API & MCPDokumentasyon

Platform ng Agent at API ng Road User Tools

I-convert ang mga distansya

Mag-convert sa pagitan ng kilometro, metro, milya, yarda, at talampakan.

Mga interface

POST
REST endpoint/api/v1/distance/convert
MCP
Pangalan ng toolconvert_distance

Kahilingan

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/distance/convert \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "value": 10,
  "from": "km",
  "to": "mi"
}'
Humiling ng katawanjson
{
  "value": 10,
  "from": "km",
  "to": "mi"
}

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": {
    "input": {
      "value": 10,
      "from": "km",
      "to": "mi"
    },
    "conversions": {
      "km": 10,
      "m": 10000,
      "mi": 6.2137119223733395,
      "yd": 10936.132983377078,
      "ft": 32808.39895013123
    },
    "result": 6.2137119223733395
  }
}

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": {
    "value": {
      "type": "number",
      "description": "Distance value to convert. Must be finite and non-negative."
    },
    "from": {
      "type": "string",
      "enum": [
        "km",
        "m",
        "mi",
        "yd",
        "ft"
      ],
      "description": "Input distance unit."
    },
    "to": {
      "type": "string",
      "enum": [
        "km",
        "m",
        "mi",
        "yd",
        "ft"
      ],
      "description": "Optional target unit. When omitted, all units are returned."
    }
  },
  "required": [
    "value",
    "from"
  ]
}

Output schema

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "input": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "value": {
          "type": "number"
        },
        "from": {
          "type": "string",
          "enum": [
            "km",
            "m",
            "mi",
            "yd",
            "ft"
          ]
        },
        "to": {
          "type": "string",
          "enum": [
            "km",
            "m",
            "mi",
            "yd",
            "ft"
          ]
        }
      },
      "required": [
        "value",
        "from"
      ]
    },
    "conversions": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "km": {
          "type": "number"
        },
        "m": {
          "type": "number"
        },
        "mi": {
          "type": "number"
        },
        "yd": {
          "type": "number"
        },
        "ft": {
          "type": "number"
        }
      },
      "required": [
        "km",
        "m",
        "mi",
        "yd",
        "ft"
      ]
    },
    "result": {
      "type": "number",
      "description": "Target-unit result when a target unit is supplied."
    }
  },
  "required": [
    "input",
    "conversions"
  ]
}
API at MCP dokumentasyon