Skip to main content
Glama
Mapbox MCP Server

Mapbox MCP Server

Official
by mapbox

Nearest Point on Line

nearest_point_on_line_tool
Read-onlyIdempotent

Snap a point to the nearest position on a line or route and get the closest point plus distance. Works offline for map-matching without API calls.

Instructions

Snap a point to the nearest position on a line or route. Returns the closest point on the line and the distance to it. Useful for "which point on this route is closest to my location?" or map-matching without the API. Works offline without 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": {
      "point": "<point>",
      "line": "<line>"
    },
    "name": "nearest_point_on_line_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
lineYesLineString coordinates as [longitude, latitude] pairs
pointYesThe point to snap to the line
unitsNoUnits for the distance resultkilometers

Output Schema

NameRequiredDescriptionDefault
unitsYesDistance units
nearestYesThe nearest point on the line
distanceYesDistance from the input point to the nearest point on the line
locationYesDistance along the line to the nearest point

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.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so the safety profile is fully covered. The description adds two genuinely new facts: the return shape (closest point plus distance) and offline operation with no API calls. It says nothing about how degenerate inputs (for example, a single-point line) are handled, but given the annotation coverage a 3 is fair.

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?

The description is front-loaded with the core action and result, then follows with a use case and an offline note. Four short sentences, none obviously wasted, though the offline remark slightly overlaps what the annotation set already implies about a closed-world, local computation.

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 not be explained further, and annotations cover safety and idempotency. Given only three parameters and moderate nesting complexity, the description covers purpose, a use case, and offline behavior adequately; the only real gap is the lack of sibling differentiation and edge-case behavior.

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%: the point, its nested longitude/latitude bounds, the line's [longitude, latitude] pairs, and the units enum with its default are all documented in the schema itself. The description adds nothing about parameter formats, coordinate ordering, or the units parameter, so the baseline 3 is appropriate.

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: 'Snap a point to the nearest position on a line or route,' plus what is returned ('closest point on the line and the distance to it'). It does not, however, differentiate itself from plausible siblings like nearest_point_tool, map_matching_tool, or distance_tool, so an agent must infer the distinction from names alone.

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?

It provides a concrete usage scenario ('which point on this route is closest to my location?') and a hint at an alternative path ('map-matching without the API'), which implies when this tool is preferable. But it never names a sibling tool or states explicit exclusions, so the routing guidance remains implied rather than actionable.

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