# calculate_haversine_distance

Use this when you need the straight-line distance between two GPS coordinates or cities, e.g. for flight distance, range checks or geofencing. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery. Do not use this when you need road distance, or ellipsoidal accuracy better than about 0.5 % (use a geodesic method such as Vincenty or Karney on WGS-84); for bearings and compass points use compass-bearing. What it computes: Computes the great-circle (as-the-crow-flies) distance between two points on a spherical Earth with the haversine formula, in kilometres, miles and nautical miles, together with the initial bearing, compass direction and the midpoint of the route. Inputs: lat1 (number, °); lon1 (number, °); lat2 (number, °); lon2 (number, °). Complete JSON argument examples: {"lat1":-33.8688,"lon1":151.2093,"lat2":35.6762,"lon2":139.6503} | {"lat1":50.06639,"lon1":-5.71472,"lat2":58.64389,"lon2":-3.07} Outputs: distance_km [km], distance_miles [mi], distance_nautical_miles [nmi], central_angle_degrees [°], initial_bearing_degrees [°], compass_direction, midpoint_lat [°], midpoint_lon [°]. Formula: a = sin²(Δφ/2) + cos φ1 · cos φ2 · sin²(Δλ/2); c = 2 · atan2(√a, √(1−a)); d = R · c with R = 6371.0088 km; θ = atan2(sin Δλ · cos φ2, cos φ1 · sin φ2 − sin φ1 · cos φ2 · cos Δλ) Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/haversine-distance with the same JSON input fields. Do not guess another /api/* path. Docs: https://tttkmbb.com/time/haversine-distance.md

Agent View of the PolicyLayer registry record for `calculate_haversine_distance`. HTML page: https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-haversine-distance

## Facts

- Tool: `calculate_haversine_distance`
- Server: Calcgrid (`https://tttkmbb.com/mcp`) — https://policylayer.com/tools/com-tttkmbb-calcgrid.md
- Homepage: https://github.com/https://tttkmbb.com/mcp
- Risk category: Read (Low risk)
- Registry record: grade D, identity unverified
- Server auth posture: open
- Server CORS policy: *
- Server rate-limited: no
- Parameters: 4 (4 required)
- Recommended policy verdict: Allowed

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `lat1` | number | yes | Latitude of point 1 in decimal degrees (north positive, south negative). Unit: °. |
| `lat2` | number | yes | Latitude of point 2 in decimal degrees (north positive, south negative). Unit: °. |
| `lon1` | number | yes | Longitude of point 1 in decimal degrees (east positive, west negative). Unit: °. |
| `lon2` | number | yes | Longitude of point 2 in decimal degrees (east positive, west negative). Unit: °. |

Parameters from the server's own tool schema.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "calculate_haversine_distance",
    "arguments": {
      "lat1": 0,
      "lat2": 0,
      "lon1": 0,
      "lon2": 0
    }
  }
}
```

## Why calculate_haversine_distance is rated Low

Even though calculate_haversine_distance only reads data, uncontrolled read access leaks sensitive information and racks up API costs: an agent caught in a retry loop can make thousands of calls a minute without anyone noticing.

## Use case

AI agents call calculate_haversine_distance to retrieve information from Calcgrid without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Calcgrid:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "calculate_haversine_distance": {}
  }
}
```

## Other tools on Calcgrid (252)

- `calculate_bazi_four_pillars` — Execute — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-bazi-four-pillars.md
- `run_calculator` — Execute — https://policylayer.com/tools/com-tttkmbb-calcgrid/run-calculator.md
- `calculate_ab_test_significance` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-ab-test-significance.md
- `calculate_age` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-age.md
- `calculate_bmi` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-bmi.md
- `calculate_bmr` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-bmr.md
- `calculate_circle_properties` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-circle-properties.md
- `calculate_compound_interest` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-compound-interest.md
- `calculate_depth_of_field` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-depth-of-field.md
- `calculate_kinetic_energy` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-kinetic-energy.md
- `calculate_loan_payment` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-loan-payment.md
- `calculate_molar_mass` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-molar-mass.md
- `calculate_mortgage_payment` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-mortgage-payment.md
- `calculate_percentage` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-percentage.md
- `calculate_percentage_change` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-percentage-change.md
- `calculate_running_pace` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-running-pace.md
- `calculate_subnet` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-subnet.md
- `calculate_t_test` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-t-test.md
- `calculate_tdee` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/calculate-tdee.md
- `cast_plum_blossom_hexagram` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/cast-plum-blossom-hexagram.md
- `check_ar_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-ar-working-day.md
- `check_at_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-at-working-day.md
- `check_australia_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-australia-working-day.md
- `check_bd_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-bd-working-day.md
- `check_be_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-be-working-day.md
- `check_bg_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-bg-working-day.md
- `check_br_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-br-working-day.md
- `check_canada_federal_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-canada-federal-working-day.md
- `check_ch_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-ch-working-day.md
- `check_china_working_day` — Read — https://policylayer.com/tools/com-tttkmbb-calcgrid/check-china-working-day.md
- …and 222 more: https://policylayer.com/tools/com-tttkmbb-calcgrid.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=com-tttkmbb-calcgrid · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/com-tttkmbb-calcgrid
