Skip to main content
Glama

Maps Distance Matrix

maps_distance_matrix
Read-onlyIdempotent

"Travel time matrix between [N] origins and [M] destinations" / "drive-time grid via Google Maps" / "transit times between addresses", NxM distance and duration matrix between many points via Google Maps. Modes: driving, walking, bicycling, transit. Use for delivery routing, multi-stop optimization, transit-heavy planning.

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": {
      "_apiKey": "your-google_maps-api-key",
      "origins": "New York|Los Angeles",
      "destinations": "Chicago|Houston"
    },
    "name": "maps_distance_matrix"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNoTravel mode: driving, walking, bicycling, transit
_apiKeyYesGoogle Maps API key
originsYesPipe-separated origins (e.g., "New York|Boston")
destinationsYesPipe-separated destinations (e.g., "Philadelphia|Washington DC")

Output Schema

NameRequiredDescriptionDefault
rowsNoDistance/duration for each origin-destination pair
statusNoStatus of the distance matrix request
origin_addressesNoGeocoded origin addresses
destination_addressesNoGeocoded destination addresses

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "destination_addresses": {
      +      "description": "Geocoded destination addresses",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "origin_addresses": {
      +      "description": "Geocoded origin addresses",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "rows": {
      +      "description": "Distance/duration for each origin-destination pair",
      +      "items": {
      +        "properties": {
      +          "elements": {
      +            "description": "Elements for each destination from this origin",
      +            "items": {
      +              "properties": {
      +                "distance": {
      +                  "properties": {
      +                    "text": {
      +                      "description": "Human-readable distance",
      +                      "type": "string"
      +                    },
      +                    "value": {
      +                      "description": "Distance in meters",
      +                      "type": "number"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "duration": {
      +                  "properties": {
      +                    "text": {
      +                      "description": "Human-readable duration",
      +                      "type": "string"
      +                    },
      +                    "value": {
      +                      "description": "Duration in seconds",
      +                      "type": "number"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "status": {
      +                  "description": "Status for this element",
      +                  "enum": [
      +                    "OK",
      +                    "NOT_FOUND",
      +                    "ZERO_RESULTS",
      +                    "MAX_ROUTE_LENGTH_EXCEEDED"
      +                  ],
      +                  "type": "string"
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "status": {
      +      "description": "Status of the distance matrix request",
      +      "enum": [
      +        "OK",
      +        "INVALID_REQUEST",
      +        "MAX_ELEMENTS_EXCEEDED",
      +        "OVER_QUERY_LIMIT",
      +        "REQUEST_DENIED",
      +        "UNKNOWN_ERROR"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "_apiKey": "your-google_maps-api-key",
      +    "destinations": "Chicago|Houston",
      +    "origins": "New York|Los Angeles"
      +  },
      +  {
      +    "_apiKey": "your-google_maps-api-key",
      +    "destinations": "41.8781,-87.6298",
      +    "mode": "transit",
      +    "origins": "40.7128,-74.0060|34.0522,-118.2437"
      +  }
      +]
  3. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the safety profile is covered without description help. The description adds that results come from the Google Maps API and enumerates available modes, but says nothing about quota/billing exposure, per-request element limits, or batch behavior, which matter for a metered external API.

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 substantive sentences are front-loaded and efficient, and the mode enumeration sits next to the purpose where it is useful. The three leading quoted fragments ("Travel time matrix…" / "drive-time grid…" / "transit times…") are redundant search-style phrasings that a reader must scan past to reach the actual spec.

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 not be explained, and annotations cover side effects. However, for an external metered matrix API, the description omits practical limits (max origins/destinations per call, whether results are cost-scaled by NxM) that an agent needs in order to call it without failing or overspending.

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% and the schema even carries worked examples, so both pipe-separated origin/destination formatting and the mode values are already documented. The description's mode list ("driving, walking, bicycling, transit") merely restates the mode field's schema description, adding no new semantics such as defaults or validity constraints.

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 description uses concrete language ("NxM distance and duration matrix between many points via Google Maps") that names the resource and the many-to-many shape, which implicitly separates it from a single-route tool like maps_directions. The opening keyword fragments repeat the same idea in three different phrasings rather than sharpening it, but the core purpose is unambiguous.

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

Usage Guidelines3/5

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

"Use for delivery routing, multi-stop optimization, transit-heavy planning" gives positive use cases, which is real guidance. It never states when NOT to use it or names an alternative (e.g., single origin-destination pairs belong to maps_directions), so the agent must infer the routing decision from the many-points phrasing.

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.