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.

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

Input 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

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 / destinations / items
      Added value: +{}
    • addedOutput schema / properties / origins / items
      Added value: +{}
  2. 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"
      +}
  3. 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"
      +]
  4. Added

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint, so the safety profile is covered. The description adds genuinely non-obvious behavior: the 625-pair cap, the fact that durations exclude live and historical traffic, and a pointer to the duration_basis field for interpreting the output.

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 tight sentences: capability first, constraints second, usage and caveats last. Every clause carries information — the pair cap and the traffic caveat are the kind of details that change how an agent calls the tool.

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?

An output schema exists, so return structure needn't be described, and the description correctly defers to the duration_basis field for interpreting durations. For a four-parameter, read-only matrix tool, nothing needed to invoke it correctly is missing.

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 coverage is 100%, so format, ranges, defaults and enums for origins, destinations, units and costing are already fully documented. The description reinforces the endpoint format and derives the 625-pair limit from the 25 × 25 maxima, but adds no syntax or meaning 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?

States a specific verb and resource — 'Compute road distances and travel times' — plus the exact scope: 'every origin → destination pair'. It also implicitly separates itself from single-pair routing by noting the alternative 'directions' for two specific points.

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?

Gives concrete use cases (fleet dispatch, nearest-depot, bulk ETA tables) and an explicit exclusion with a named alternative: for a traffic-adjusted ETA between two points, use directions. Both the when-to-use and when-not-to-use conditions are stated.

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