Skip to main content
Glama
Mapbox MCP Server

Mapbox MCP Server

Official
by mapbox

Calculate Distance

distance_tool
Read-onlyIdempotent

Calculate the great-circle distance between two geographic coordinates using the Haversine formula, with results in kilometers, miles, meters, feet, or nautical miles. Works offline without API calls.

Instructions

Calculate the distance between two geographic coordinates. Supports various units including kilometers, miles, meters, feet, and nautical miles. Uses the Haversine formula for accurate great-circle distance calculations. This tool works offline without requiring API calls.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "from": "<from>",
      "to": "<to>"
    },
    "name": "distance_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesEnding coordinate with longitude and latitude
fromYesStarting coordinate with longitude and latitude
unitsNoUnit of measurement for distancekilometers

Output Schema

NameRequiredDescriptionDefault
toYesEnding coordinate
fromYesStarting coordinate
unitsYesUnit of measurement
distanceYesCalculated distance between points

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.18.1
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. First observedv0.12.6

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover read-only, idempotent, closed-world, non-destructive, so the description earns credit for adding that the math is a Haversine great-circle calculation (not a routed or ellipsoidal distance) and that no network access is needed. That is real behavioral context an agent could not get from the structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences with the core purpose front-loaded, and every sentence carries information. The unit list mildly duplicates the enum in the schema, which is the only slack.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, and the description covers the algorithm and the offline property. For a simple three-parameter calculation tool this is nearly complete; only the default unit and the spherical-model approximation caveat are left implicit.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the nested coordinate objects carry their own descriptions and ranges, so the schema already does the work. The description only restates the unit options that the enum already enumerates, adding no format or default guidance beyond it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Calculate the distance between two geographic coordinates.' This is unambiguous and separable from area/length/bearing siblings by the 'two coordinates' scope, though no sibling is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit when-to-use or when-not guidance; it never says to prefer directions_tool for routed/path distance or matrix_tool for many-to-many. The note that it 'works offline without requiring API calls' is an implicit differentiator, but the agent must infer the choice conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.