Skip to main content
Glama

distance_matrix

Read-only

Travel times (seconds) and road distances (metres) from each source to each destination among up to 25 places ([lng, lat] each), by car, truck, bike or on foot, in the shape of Mapbox Matrix v1: durations[i][j] and distances[i][j], null where no road joins a pair. Sources and destinations default to every point. For the nearest store to each customer, a delivery order, or a table of drive times. Counts one lookup per pair (sources times destinations) against the workspace's monthly searches, on every plan, all or nothing; past the plan it returns searches_exhausted and nothing is charged. Show the returned attribution with the results.

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": {
      "points": "<points>"
    },
    "name": "distance_matrix"
  }
}

Input Schema

NameRequiredDescriptionDefault
key_idNoThe map key (uuid from list_keys) to count the lookups against. Default: the workspace's first active secret key, else its first publishable one.
pointsYesThe places, each [lng, lat], 2 to 25.
profileNodriving (the default), driving-hgv (a truck), cycling or walking.
sourcesNoWhich points to measure from, as indexes into points. Default: all of them.
destinationsNoWhich points to measure to, as indexes into points. Default: all of them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the readOnly annotation, it discloses the billing model: one lookup per source-destination pair against monthly searches, all-or-nothing quota behavior, the searches_exhausted failure mode, and that attribution must be shown. It also explains null entries when no road connects a pair.

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 return values and remains dense with useful information rather than filler. It is slightly long and packs several concerns into a run-on flow, but every sentence carries relevant context.

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

Completeness5/5

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

For a complex matrix tool with no output schema, the description explains the return shape, default source/destination behavior, travel modes, null handling, quota semantics, failure mode, and attribution requirement. An agent has enough information to invoke and interpret the tool correctly.

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%, so parameter meanings are already well documented. The description reinforces defaults and the cost relation between sources and destinations, but adds little new syntax or semantic detail beyond the schema.

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

Purpose5/5

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

The description names a specific resource and output: travel times and road distances from each source to each destination among up to 25 places, in a Mapbox Matrix v1 shape. It also specifies supported travel modes and the null result for disconnected pairs, making the tool clearly distinct from a single-route directions tool.

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

Usage Guidelines4/5

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

It gives concrete usage examples such as nearest-store analysis, delivery ordering, and drive-time tables. It does not explicitly name alternatives or state when not to use this tool, but the use context is clear enough for selection.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources