Skip to main content
Glama

distance_matrix

Read-onlyIdempotent

Compute road distances and travel times for every origin → destination pair. Endpoints accept free-text addresses or 'lat,lon' strings; N × M is capped at 625 pairs. Use for fleet dispatch, nearest-depot, and bulk ETA tables. Durations do NOT include live or historical traffic — see duration_basis; use directions for a traffic-adjusted ETA between two specific points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unitsNoDistance units (default kilometers)
costingNoTransport mode (default auto)
originsYesOrigin endpoints (1–25): address or 'lat,lon'
destinationsYesDestination endpoints (1–25): address or 'lat,lon'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
metaNo
unitsYes
matrixYesmatrix[i][j] = origin i → destination j: { distance (in the requested units), time_seconds }; both null when no route exists
costingYes
originsYesGeocoded origin locations
destinationsYesGeocoded destination locations
duration_basisNoHow matrix durations were computed. `static_road_speeds` (the only value today): durations come from the road network's own speed data — posted limits and road-class defaults — never from historical or live traffic. Use `directions` for a traffic-adjusted ETA between two specific points.
upstream_errorNo
traffic_appliedNoWhether live or historical traffic influenced any matrix duration. Always false today — see `duration_basis`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / duration_basis
      Added value: +{
      +  "const": "static_road_speeds",
      +  "description": "How matrix durations were computed. `static_road_speeds` (the only value today): durations come from the road network's own speed data — posted limits and road-class defaults — never from historical or live traffic. Use `directions` for a traffic-adjusted ETA between two specific points.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / traffic_applied
      Added value: +{
      +  "const": false,
      +  "description": "Whether live or historical traffic influenced any matrix duration. Always false today — see `duration_basis`.",
      +  "type": "boolean"
      +}
  2. Changed3 schema fields changed
    • changedOutput schema / properties / matrix / description
      Previous value: -"matrix[i][j] = origin i → destination j (distance + duration)"New value: +"matrix[i][j] = origin i → destination j: { distance (in the requested units), time_seconds }; both null when no route exists"
    • addedOutput schema / properties / matrix / items / items
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "distance": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "time_seconds": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    }
      +  },
      +  "required": [
      +    "distance",
      +    "time_seconds"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / units / enum
      Added value: +[
      +  "miles",
      +  "kilometers"
      +]
  3. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already signal read-only/idempotent, so the description adds non-obvious behavior: the 625-pair cap, endpoint format flexibility, and the crucial caveat that durations exclude live or historical traffic, pointing to duration_basis. No contradiction with annotations.

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

Conciseness5/5

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

Three compact sentences front-load the core capability, then add usage context and the key caveat. Every sentence earns its place with no filler.

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 four-parameter tool with full schema coverage and an output schema, the description covers selection, invocation constraints, and the main behavioral caveat. The reference to duration_basis is acceptable as a pointer to an output field.

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 the schema already documents all four parameters. The description adds the 625-pair cap and endpoint formats, but these are mostly derived from or redundant with the schema, so no extra parameter burden is needed.

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?

Clearly names a concrete operation (compute road distances and travel times) on a defined resource (every origin→destination pair). It also distinguishes itself from directions by noting it is for bulk pair matrices, not a single traffic-adjusted route.

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

Usage Guidelines5/5

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

Explicitly lists use cases (fleet dispatch, nearest-depot, bulk ETA tables) and names directions as the alternative when a traffic-adjusted point-to-point ETA is needed. This gives an agent a clear decision rule rather than a vague hint.

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