Skip to main content
Glama

compute_routes

Read-only

Computes travel routes between an origin and a destination, optionally through intermediate stops. Returns the distance and duration for each route.

Input Requirements (CRITICAL):

  1. origin and destination (objects - MANDATORY): Each must be provided using exactly one of:

    • address (string, e.g., 'Eiffel Tower, Paris'). Named places, landmarks, and businesses are resolved directly, so do NOT call search_places first just to geocode a waypoint. Include any city, region, or country the user mentioned.

    • lat_lng (object, {"latitude": number, "longitude": number}).

    • place_id (string, e.g., 'ChIJOwE_Id1w5EAR4Q27FkL6T_0'), for example from search_places.

  2. intermediate_waypoints (array of objects - OPTIONAL): Up to 25 stops to pass through, in order, between the origin and destination. Same format as origin. Not supported with TRANSIT. Only include stops the user asked for; specifying more than 10 intermediate waypoints will incur a higher cost and higher latency.

  3. travel_mode (enum - OPTIONAL): DRIVE (default), WALK, BICYCLE, or TRANSIT.

  4. Timing (OPTIONAL - set at most ONE): RFC 3339 timestamps with a UTC offset, e.g., '2026-09-19T08:00:00-07:00'. Defaults to departing now. For TRANSIT, the time can be up to 7 days in the past or up to 100 days in the future. For other modes, the time can be up to 365 days in the future and must not be in the past.

    • departure_time: Use when the user says when they will leave (e.g., "tomorrow at 8am").

    • arrival_time: Use when the user says when they must arrive (e.g., "be there by 9am").

  5. routing_preference (enum - OPTIONAL):

    • ROUTING_PREFERENCE_TRAFFIC_UNAWARE (default): ignores live traffic, incidents, and closures. Lowest latency.

    • ROUTING_PREFERENCE_TRAFFIC_AWARE_OPTIMAL: uses live traffic conditions when available. Not supported for WALK or BICYCLE. Set this ONLY when the user asks about traffic, congestion, or a traffic-adjusted ETA. It incurs higher cost and latency.

  6. location_bias (object - OPTIONAL): {"latitude": number, "longitude": number} used to disambiguate place names in waypoint addresses. If a name is ambiguous (e.g., "Springfield") and the user gave no region, keep the name as given in address and set location_bias toward the intended area instead of guessing a region.

  7. compute_alternative_routes (boolean - OPTIONAL): Set to true only when the user asks for route options or alternatives. Defaults to false, which returns only the recommended route.

  8. include_polyline (boolean - OPTIONAL): Set to true only when the route geometry (encoded_polyline) is needed. Defaults to false.

Instructions for Tool Call:

  • If the origin or the destination is missing, you MUST ask the user for clarification before calling the tool.

  • For "How far is A from B?" questions, use B as the origin and A as the destination.

Example Tool Call: {"origin":{"address":"Eiffel Tower"},"destination":{"place_id":"ChIJt_5xIthw5EARoJ71mGq7t74"},"intermediate_waypoints":[{"address":"Louvre Museum"}],"travel_mode":"DRIVE","departure_time":"2026-09-19T08:00:00+02:00"}

Instructions for Response:

  • When alternative routes are requested, routes are ordered from most to least recommended.

  • If routes is empty, tell the user no route was found. Do not guess a route.

  • To find places along a DRIVE route, pass the route's retrieval_token to search_along_route. The token is valid for 10 minutes.

  • Only state facts returned by the tool. Do NOT invent turn-by-turn directions, transit lines, stations, platforms, or transfers.

  • The grounded output must be attributed to the source using each route's attribution field when available.

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": {
      "origin": "<origin>",
      "destination": "<destination>"
    },
    "name": "compute_routes"
  }
}

Input Schema

NameRequiredDescriptionDefault
originYesRequired. Origin waypoint.
travelModeNoOptional. Specifies the mode of transportation.
arrivalTimeNoOptional. Indicates that the route should be computed based on arrival time. Only one of this field or departureTime should be set.
destinationYesRequired. Destination waypoint.
locationBiasNoOptional. A location to bias the search results toward, for example to disambiguate waypoint text queries.
departureTimeNoOptional. Indicates that the route should be computed based on departure time. Only one of this field or arrivalTime should be set.
includePolylineNoOptional. Whether to include the encoded polyline in the response routes. Defaults to `false`. When set to `true`, `Route.encoded_polyline` is returned.
routingPreferenceNoOptional. Determines how traffic data is used to compute the route. `ROUTING_PREFERENCE_TRAFFIC_AWARE_OPTIMAL` is not supported when `travel_mode` is `WALK` or `BICYCLE`. For `TRANSIT`, it enables realtime transit data, such as delays and cancellations.
intermediateWaypointsNoOptional. Intermediate stops between the origin and destination to pass through in order. Up to 25 intermediate waypoints are supported. Specifying more than 10 intermediate waypoints will incur higher cost and higher latency. Intermediate waypoints are not supported when `travel_mode` is `TRANSIT`.
computeAlternativeRoutesNoOptional. Whether to compute alternative routes in addition to the recommended route. Defaults to false, in which case only the recommended route is returned. When set to true, up to all available routes are returned, though alternatives may not be available for every request.

Output Schema

NameRequiredDescriptionDefault
routesNoContains routes between the requested origin and destination, ordered from most recommended to least recommended. Only one route is returned unless `ComputeRoutesRequest.compute_alternative_routes` is set to true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / intermediateWaypoints / description
      Previous value: -"Optional. Intermediate stops between the origin and destination to pass through in order. At most 10 intermediate waypoints are supported. Intermediate waypoints are not supported when `travel_mode` is `TRANSIT`."New value: +"Optional. Intermediate stops between the origin and destination to pass through in order. Up to 25 intermediate waypoints are supported. Specifying more than 10 intermediate waypoints will incur higher cost and higher latency. Intermediate waypoints are not supported when `travel_mode` is `TRANSIT`."
    • changedInput schema / properties / routingPreference / x-google-enum-descriptions
      Previous value: -[
      -  "No routing preference specified. Defaults to `ROUTING_PREFERENCE_TRAFFIC_UNAWARE`.",
      -  "Computes routes without taking live traffic conditions into consideration. Suitable when traffic conditions don't matter or are not applicable. Using this value produces the lowest latency.",
      -  "Calculates routes taking live traffic conditions into consideration, when traffic data is available. For `TRANSIT`, uses realtime transit data, such as delays and cancellations, when available. This value will trigger the Pro tier and incur higher billing cost and latency. This is only available for allowlisted customers. If not allowlisted, the request will fall back to `ROUTING_PREFERENCE_TRAFFIC_UNAWARE`."
      -]New value: +[
      +  "No routing preference specified. Defaults to `ROUTING_PREFERENCE_TRAFFIC_UNAWARE`.",
      +  "Computes routes without taking live traffic conditions into consideration. Suitable when traffic conditions don't matter or are not applicable. Using this value produces the lowest latency.",
      +  "Calculates routes taking live traffic conditions into consideration, when traffic data is available. For `TRANSIT`, uses realtime transit data, such as delays and cancellations, when available. This value will trigger the Pro tier and incur higher billing cost and latency."
      +]
  2. Changed5 schema fields changed
    • changedInput schema / $defs / Waypoint / properties / address / description
      Previous value: -"Human readable address or a plus code. See https://plus.codes for details."New value: +"Human readable address or a plus code. See https://plus.codes for details. Only one of the following fields should be set: this field, latLng, placeId."
    • changedInput schema / $defs / Waypoint / properties / latLng / description
      Previous value: -"A point specified using geographic coordinates."New value: +"A point specified using geographic coordinates. Only one of the following fields should be set: this field, placeId, address."
    • changedInput schema / $defs / Waypoint / properties / placeId / description
      Previous value: -"The Place ID associated with the waypoint."New value: +"The Place ID associated with the waypoint. Only one of the following fields should be set: this field, latLng, address."
    • changedInput schema / properties / arrivalTime / description
      Previous value: -"Optional. Indicates that the route should be computed based on arrival time."New value: +"Optional. Indicates that the route should be computed based on arrival time. Only one of this field or departureTime should be set."
    • changedInput schema / properties / departureTime / description
      Previous value: -"Optional. Indicates that the route should be computed based on departure time."New value: +"Optional. Indicates that the route should be computed based on departure time. Only one of this field or arrivalTime should be set."
  3. Changed11 schema fields changed
    • addedInput schema / properties / arrivalTime
      Added value: +{
      +  "description": "Optional. Indicates that the route should be computed based on arrival time.",
      +  "format": "date-time",
      +  "type": "string"
      +}
    • addedInput schema / properties / computeAlternativeRoutes
      Added value: +{
      +  "description": "Optional. Whether to compute alternative routes in addition to the recommended route. Defaults to false, in which case only the recommended route is returned. When set to true, up to all available routes are returned, though alternatives may not be available for every request.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / departureTime
      Added value: +{
      +  "description": "Optional. Indicates that the route should be computed based on departure time.",
      +  "format": "date-time",
      +  "type": "string"
      +}
    • addedInput schema / properties / includePolyline
      Added value: +{
      +  "description": "Optional. Whether to include the encoded polyline in the response routes. Defaults to `false`. When set to `true`, `Route.encoded_polyline` is returned.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / intermediateWaypoints
      Added value: +{
      +  "description": "Optional. Intermediate stops between the origin and destination to pass through in order. At most 10 intermediate waypoints are supported. Intermediate waypoints are not supported when `travel_mode` is `TRANSIT`.",
      +  "items": {
      +    "$ref": "#/$defs/Waypoint"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / locationBias
      Added value: +{
      +  "$ref": "#/$defs/LatLng",
      +  "description": "Optional. A location to bias the search results toward, for example to disambiguate waypoint text queries."
      +}
    • addedInput schema / properties / routingPreference
      Added value: +{
      +  "description": "Optional. Determines how traffic data is used to compute the route. `ROUTING_PREFERENCE_TRAFFIC_AWARE_OPTIMAL` is not supported when `travel_mode` is `WALK` or `BICYCLE`. For `TRANSIT`, it enables realtime transit data, such as delays and cancellations.",
      +  "enum": [
      +    "ROUTING_PREFERENCE_UNSPECIFIED",
      +    "ROUTING_PREFERENCE_TRAFFIC_UNAWARE",
      +    "ROUTING_PREFERENCE_TRAFFIC_AWARE_OPTIMAL"
      +  ],
      +  "type": "string",
      +  "x-google-enum-descriptions": [
      +    "No routing preference specified. Defaults to `ROUTING_PREFERENCE_TRAFFIC_UNAWARE`.",
      +    "Computes routes without taking live traffic conditions into consideration. Suitable when traffic conditions don't matter or are not applicable. Using this value produces the lowest latency.",
      +    "Calculates routes taking live traffic conditions into consideration, when traffic data is available. For `TRANSIT`, uses realtime transit data, such as delays and cancellations, when available. This value will trigger the Pro tier and incur higher billing cost and latency. This is only available for allowlisted customers. If not allowlisted, the request will fall back to `ROUTING_PREFERENCE_TRAFFIC_UNAWARE`."
      +  ]
      +}
    • changedInput schema / properties / travelMode / enum
      Previous value: -[
      -  "ROUTE_TRAVEL_MODE_UNSPECIFIED",
      -  "DRIVE",
      -  "WALK"
      -]New value: +[
      +  "ROUTE_TRAVEL_MODE_UNSPECIFIED",
      +  "DRIVE",
      +  "WALK",
      +  "BICYCLE",
      +  "TRANSIT"
      +]
    • changedInput schema / properties / travelMode / x-google-enum-descriptions
      Previous value: -[
      -  "No travel mode specified. Defaults to `DRIVE`.",
      -  "Travel by passenger car.",
      -  "Travel by walking. NOTE: `WALK` routes are in beta and might sometimes be missing clear sidewalks or pedestrian paths. You must display this warning to the user for all walking that you display in your app."
      -]New value: +[
      +  "No travel mode specified. Defaults to `DRIVE`.",
      +  "Travel by passenger car.",
      +  "Travel by walking. NOTE: `WALK` routes are in beta and might sometimes be missing clear sidewalks or pedestrian paths. You must display this warning to the user for all walking that you display in your app.",
      +  "Travel by bicycle.",
      +  "Travel by public transit."
      +]
    • addedOutput schema / $defs / Route / properties / encodedPolyline
      Added value: +{
      +  "description": "An encoded polyline of the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm",
      +  "type": "string"
      +}
    • addedOutput schema / $defs / Route / properties / retrievalToken
      Added value: +{
      +  "description": "A token that can be used to retrieve this specific route in downstream tools, such as SearchAlongRoute. Valid for 10 minutes.",
      +  "type": "string"
      +}
  4. Changed1 schema field changed
    • changedOutput schema / properties / routes / description
      Previous value: -"Contains routes between the requested origin and destination. Currently only one route is returned."New value: +"Contains routes between the requested origin and destination, ordered from most recommended to least recommended. Only one route is returned unless `ComputeRoutesRequest.compute_alternative_routes` is set to true."
  5. Changed1 schema field changed
    • changedOutput schema / $defs / Route / description
      Previous value: -"Details about a route between two locations."New value: +"Details about a route between locations."
  6. Changed2 schema fields changed
    • addedOutput schema / $defs / Attribution
      Added value: +{
      +  "description": "Required attribution to show with maps content.",
      +  "properties": {
      +    "title": {
      +      "description": "The title to display for the attribution.",
      +      "type": "string"
      +    },
      +    "url": {
      +      "description": "The URL to link to for the attribution.",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / $defs / Route / properties / attribution
      Added value: +{
      +  "$ref": "#/$defs/Attribution",
      +  "description": "Required attribution to show with the route."
      +}
  7. First observed

TDQS

A4.9/5.0
Behavior5/5

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

The read-only annotations already establish safety, but the description adds substantive behavior beyond them: the 25-stop cap, higher cost above 10 intermediate waypoints, time-window limits by travel mode, the 10-minute retrieval_token, traffic-aware cost and latency, empty-route handling, and a prohibition on inventing directions. 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?

The description is long but front-loaded with a clear one-sentence purpose, then organized into numbered input requirements, call instructions, an example, and response rules. Every section earns its place for a 10-parameter routing tool with several constraints.

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?

Because an output schema exists, the description need not fully document return values, but it still covers route ordering, empty results, attribution, and the retrieval_token handoff to search_along_route. It is complete for a complex route-computation tool.

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 coverage is 100%, yet the description adds meaningful semantics: exactly one waypoint representation, address versus place_id usage, departure/arrival mutual exclusivity, traffic-preference restrictions, and location_bias for ambiguous names. However, it uses snake_case parameter names such as `lat_lng`, `place_id`, and `travel_mode` that do not match the schema's camelCase properties (`latLng`, `placeId`, `travelMode`), which may cause invocation confusion.

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 opening sentence specifies a concrete verb ('Computes'), resource ('travel routes'), scope (origin to destination, optional intermediate stops), and key return fields ('distance and duration'). It clearly distinguishes the tool from siblings such as search_places and search_along_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?

The definition gives explicit when-to-use guidance and exclusions: do not call search_places merely to geocode an address, set routing_preference only when traffic is relevant, set compute_alternative_routes only when alternatives are requested, and ask for clarification when origin or destination is missing. These instructions leave little ambiguity about tool selection and call readiness.

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