Skip to main content
Glama

Matrix

matrix
Read-onlyIdempotent

"Distance matrix between locations" / "all-to-all travel times" / "NxM routing grid" / "drive / walk / bike times between [list]", NxM distance and duration matrix between many points via OpenStreetMap routing. Use for traveling-salesman setup, multi-stop optimization, nearest-warehouse, fleet dispatch. Profile-aware (car / truck / bike / foot / wheelchair).

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "metrics": [
        "duration",
        "distance"
      ],
      "profile": "driving-car",
      "locations": [
        [
          8.681495,
          49.41461
        ],
        [
          8.687872,
          49.420318
        ],
        [
          8.675444,
          49.418892
        ]
      ]
    },
    "name": "matrix"
  }
}

Input Schema

NameRequiredDescriptionDefault
metricsNo["duration","distance"]
profileNo
sourcesNoWhich `locations` to route FROM, as 0-based indices into that array, e.g. [0] means the first location. NOT coordinates. Omit to use every location.
locationsYes
destinationsNoWhich `locations` to route TO, as 0-based indices into that array, e.g. [1,2]. NOT coordinates. Omit to use every location.

Output Schema

NameRequiredDescriptionDefault
sourcesYes
metadataYes
distancesNoMeters; only when metrics includes "distance"
durationsNoSeconds, sources x destinations
destinationsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / durations / description
      Previous value: -"Seconds, sources × destinations"New value: +"Seconds, sources x destinations"
  2. Changed2 schema fields changed
    • changedInput schema / properties / destinations / description
      Previous value: -"Which `locations` to route TO, as 0-based indices into that array — e.g. [1,2]. NOT coordinates. Omit to use every location."New value: +"Which `locations` to route TO, as 0-based indices into that array, e.g. [1,2]. NOT coordinates. Omit to use every location."
    • changedInput schema / properties / sources / description
      Previous value: -"Which `locations` to route FROM, as 0-based indices into that array — e.g. [0] means the first location. NOT coordinates. Omit to use every location."New value: +"Which `locations` to route FROM, as 0-based indices into that array, e.g. [0] means the first location. NOT coordinates. Omit to use every location."
  3. Changed3 schema fields changed
    • changedOutput schema / description
      Previous value: -"Distance/duration matrix response from OpenRouteService"New value: +"Travel-time / distance matrix. `durations` and `distances` each appear only when the corresponding entry is in `metrics` (durations is the default), so neither is guaranteed."
    • addedOutput schema / properties
      Added value: +{
      +  "destinations": {
      +    "items": {
      +      "properties": {
      +        "location": {
      +          "description": "[lon, lat] snapped to the road network",
      +          "items": {
      +            "type": "number"
      +          },
      +          "type": "array"
      +        },
      +        "snapped_distance": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "distances": {
      +    "description": "Meters; only when metrics includes \"distance\"",
      +    "items": {
      +      "items": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "durations": {
      +    "description": "Seconds, sources × destinations",
      +    "items": {
      +      "items": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "metadata": {
      +    "properties": {
      +      "attribution": {
      +        "type": "string"
      +      },
      +      "engine": {
      +        "properties": {
      +          "build_date": {
      +            "type": "string"
      +          },
      +          "graph_date": {
      +            "type": "string"
      +          },
      +          "osm_date": {
      +            "type": "string"
      +          },
      +          "version": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "query": {
      +        "description": "Echo of the request",
      +        "type": "object"
      +      },
      +      "service": {
      +        "type": "string"
      +      },
      +      "timestamp": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "sources": {
      +    "items": {
      +      "properties": {
      +        "location": {
      +          "description": "[lon, lat] snapped to the road network",
      +          "items": {
      +            "type": "number"
      +          },
      +          "type": "array"
      +        },
      +        "snapped_distance": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "sources",
      +  "destinations",
      +  "metadata"
      +]
  4. Changed3 schema fields changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "locations": [
      -      [
      -        8.681495,
      -        49.41461
      -      ],
      -      [
      -        8.687872,
      -        49.420318
      -      ],
      -      [
      -        8.675444,
      -        49.418892
      -      ]
      -    ],
      -    "metrics": [
      -      "duration",
      -      "distance"
      -    ],
      -    "profile": "driving-car"
      -  }
      -]New value: +[
      +  {
      +    "locations": [
      +      [
      +        8.681495,
      +        49.41461
      +      ],
      +      [
      +        8.687872,
      +        49.420318
      +      ],
      +      [
      +        8.675444,
      +        49.418892
      +      ]
      +    ],
      +    "metrics": [
      +      "duration",
      +      "distance"
      +    ],
      +    "profile": "driving-car"
      +  },
      +  {
      +    "destinations": [
      +      1,
      +      2
      +    ],
      +    "locations": [
      +      [
      +        8.681495,
      +        49.41461
      +      ],
      +      [
      +        8.686507,
      +        49.41943
      +      ],
      +      [
      +        8.687872,
      +        49.420318
      +      ]
      +    ],
      +    "profile": "driving-car",
      +    "sources": [
      +      0
      +    ]
      +  }
      +]
    • addedInput schema / properties / destinations / description
      Added value: +"Which `locations` to route TO, as 0-based indices into that array — e.g. [1,2]. NOT coordinates. Omit to use every location."
    • addedInput schema / properties / sources / description
      Added value: +"Which `locations` to route FROM, as 0-based indices into that array — e.g. [0] means the first location. NOT coordinates. Omit to use every location."
  5. Changed2 schema fields changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "locations": [
      +      [
      +        8.681495,
      +        49.41461
      +      ],
      +      [
      +        8.687872,
      +        49.420318
      +      ],
      +      [
      +        8.675444,
      +        49.418892
      +      ]
      +    ],
      +    "metrics": [
      +      "duration",
      +      "distance"
      +    ],
      +    "profile": "driving-car"
      +  }
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "Distance/duration matrix response from OpenRouteService",
      +  "type": "object"
      +}
  6. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare read-only, idempotent, non-destructive, open-world behavior, so safety is covered. The description adds that results are profile-aware across car/truck/bike/foot/wheelchair and sourced from OSM routing, which is useful. It says nothing about matrix size limits or failure modes, which matter for a routing call that returns NxM results.

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

Conciseness3/5

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

The functional content is front-loaded in a single dense sentence. The preceding slash-separated keyword string ("Distance matrix between locations" / "all-to-all travel times" / "NxM routing grid" / ...) restates the same idea four times and adds no decision-relevant information.

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

Completeness3/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 no explanation, and the use-case list covers intent. For a 5-parameter, open-world routing tool it is still thin on the operational details an agent needs — profile name format, coordinate convention, and any cap on locations/sources/destinations.

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 60%, and the description contributes the profile vocabulary that the `profile` property lacks (no enum, no description). However it never clarifies coordinate order in `locations` or what values `metrics` accepts, both of which are easy places to call the tool incorrectly.

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?

The core sentence states a specific verb and resource: an NxM distance and duration matrix between many points via OpenStreetMap routing. The all-pairs nature clearly separates it from a single-route directions sibling, though the description never names that sibling to make the contrast explicit.

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 contexts — traveling-salesman setup, multi-stop optimization, nearest-warehouse, fleet dispatch — which tells an agent when this tool is the right pick. It stops short of stating when NOT to use it or which sibling to fall back on for a single-leg route.

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.