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 10 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.

  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.

  • 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.

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. At most 10 intermediate waypoints are supported. 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. 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."
  2. 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"
      +}
  3. 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."
  4. 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."
  5. 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."
      +}
  6. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the read-only/non-destructive annotations, the description discloses cost and latency implications of traffic-aware routing, timing windows (7 days past/100 days future for transit, 365 days future for other modes), default behaviors, and response handling for empty routes. It additionally sets response guardrails against inventing turn-by-turn details and requires attribution.

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 description is long but well-organized with a purpose sentence, numbered input requirements, an example, and response instructions, so it stays navigable. Some content duplicates schema documentation (waypoint exclusivity, max 10 stops, enum behavior), which is useful but not strictly necessary.

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 10 parameters, nested waypoint objects, and an output schema, the description covers everything an agent needs: mandatory origin/destination formats, optional parameter trade-offs, timing constraints, and response behavior. Return-value details are appropriately left to the output schema.

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

Parameters5/5

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

Although schema coverage is 100%, the description adds decision semantics the schema lacks: set routing_preference to traffic-aware only on explicit traffic questions, use departure_time vs arrival_time based on user phrasing, set compute_alternative_routes and include_polyline only when specifically requested, and use location_bias to disambiguate names rather than guessing a region.

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 states a specific verb and resource ('Computes travel routes between an origin and a destination') and adds what is returned ('distance and duration'). It also distinguishes itself from the sibling search_places by warning not to call search_places first just to geocode a waypoint.

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 description gives explicit when-to-use guidance for every optional parameter: departure_time vs arrival_time, when to enable traffic-aware routing ('ONLY when the user asks about traffic'), when to request alternatives or polyline, and when to ask the user for clarification. It also notes unsupported combinations (intermediate stops with TRANSIT, traffic-aware with WALK/BICYCLE).

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