compute_routes
Computes travel routes between an origin and a destination, optionally through intermediate stops. Returns the distance and duration for each route.
Input Requirements (CRITICAL):
originanddestination(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 callsearch_placesfirst 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 fromsearch_places.
intermediate_waypoints(array of objects - OPTIONAL): Up to 10 stops to pass through, in order, between the origin and destination. Same format asorigin. Not supported withTRANSIT. Only include stops the user asked for.travel_mode(enum - OPTIONAL):DRIVE(default),WALK,BICYCLE, orTRANSIT.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. ForTRANSIT, 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").
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 forWALKorBICYCLE. Set this ONLY when the user asks about traffic, congestion, or a traffic-adjusted ETA. It incurs higher cost and latency.
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 inaddressand setlocation_biastoward the intended area instead of guessing a region.compute_alternative_routes(boolean - OPTIONAL): Set totrueonly when the user asks for route options or alternatives. Defaults tofalse, which returns only the recommended route.include_polyline(boolean - OPTIONAL): Set totrueonly when the route geometry (encoded_polyline) is needed. Defaults tofalse.
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
originand A as thedestination.
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
routesis 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
attributionfield when available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origin | Yes | Required. Origin waypoint. | |
| travelMode | No | Optional. Specifies the mode of transportation. | |
| arrivalTime | No | Optional. Indicates that the route should be computed based on arrival time. Only one of this field or departureTime should be set. | |
| destination | Yes | Required. Destination waypoint. | |
| locationBias | No | Optional. A location to bias the search results toward, for example to disambiguate waypoint text queries. | |
| departureTime | No | Optional. Indicates that the route should be computed based on departure time. Only one of this field or arrivalTime should be set. | |
| includePolyline | No | Optional. Whether to include the encoded polyline in the response routes. Defaults to `false`. When set to `true`, `Route.encoded_polyline` is returned. | |
| routingPreference | No | 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. | |
| intermediateWaypoints | No | 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`. | |
| computeAlternativeRoutes | No | 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| routes | No | 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. |