EN
API & MCPDocumentation

Mariner GPS Tools Developer Platform

Calculate initial true bearing

Calculate the initial true bearing from one position to another.

Interfaces

POST
REST endpoint/api/v1/bearing
MCP
Tool namecalculate_bearing

Request

Send the request as JSON. MCP clients pass the same fields as tool arguments.

cURLshell
curl -X POST https://marinergps.tools/api/v1/bearing \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "from": {
    "lat": 50.1,
    "lng": -4.2
  },
  "to": {
    "lat": 49.8,
    "lng": -3.1
  }
}'
Request bodyjson
{
  "from": {
    "lat": 50.1,
    "lng": -4.2
  },
  "to": {
    "lat": 49.8,
    "lng": -3.1
  }
}

Response

REST wraps the calculation result in the standard success envelope. MCP returns the same calculation data as structured tool output.

JSON
{
  "ok": true,
  "data": {
    "degrees": 112.54786806700503,
    "compass": "ESE"
  }
}

Schemas

The definitions below show the complete JSON Schema used to validate inputs and describe outputs.

Input schema

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "from": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "lat": {
          "type": "string",
          "description": "Latitude as decimal degrees or a coordinate string such as 51° 30′ 26.4″ N."
        },
        "lng": {
          "type": "string",
          "description": "Longitude as decimal degrees or a coordinate string such as 0° 07′ 39″ W."
        }
      },
      "required": [
        "lat",
        "lng"
      ]
    },
    "to": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "lat": {
          "type": "string",
          "description": "Latitude as decimal degrees or a coordinate string such as 51° 30′ 26.4″ N."
        },
        "lng": {
          "type": "string",
          "description": "Longitude as decimal degrees or a coordinate string such as 0° 07′ 39″ W."
        }
      },
      "required": [
        "lat",
        "lng"
      ]
    }
  },
  "required": [
    "from",
    "to"
  ]
}

Output schema

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "degrees": {
      "type": "number"
    },
    "compass": {
      "type": "string"
    }
  },
  "required": [
    "degrees",
    "compass"
  ]
}
API & MCP documentation