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.

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
upstream_errorNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +]
  2. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and idempotentHint, and the description adds useful behavioral constraints beyond them: the N × M 625-pair cap and the flexible endpoint formats ('free-text addresses or lat,lon strings'). It does not contradict the 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 sentences, each with a distinct job: purpose, input constraints, and use cases. The most important information is front-loaded, with no filler or repetition of schema defaults.

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?

Given the output schema exists and the input schema fully documents parameters, the description covers everything needed to invoke it correctly: purpose, input formats, limits, and application context. Nothing essential is missing.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds extra meaning by explaining the pair cap (625) and emphasizing that endpoints can be addresses or coordinates, reinforcing and slightly extending the schema's field descriptions.

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 opens with a specific verb and resource: 'Compute road distances and travel times for every origin → destination pair.' This clearly distinguishes it from point-to-point routing (directions) and batch geocoding siblings by emphasizing the matrix nature (every pair, bulk ETAs).

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?

The description gives concrete use cases: 'fleet dispatch, nearest-depot, and bulk ETA tables.' This signals when to choose the matrix over simpler routing, though it does not explicitly name alternative tools or state when not to use it.

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