Tool: search_along_route
Call this tool when the user wants to find places, businesses, or points of interest along a travel route (e.g., "gas stations on my way to Tahoe", "coffee shops between SF and San Jose"). Calling this tool incurs higher cost than search_places, so use search_places instead when searching near a single location rather than along a route.
Input Requirements (CRITICAL):
text_query(string - MANDATORY): A natural language description of what to search for along the route.- Examples:
'ev chargers','coffee','vegetarian restaurants','rest stops'.
- Examples:
Route specification (MANDATORY - provide exactly ONE of the following):
retrieval_token(string): Theretrieval_tokenreturned by a priorcompute_routescall for aDRIVEroute. Prefer this whenever the route was already computed. The token is valid for 10 minutes.route_endpoints(object): The route'soriginanddestination. Each must be provided using one ofaddress,lat_lng, orplace_id.- Example:
{"route_endpoints": {"origin": {"address": "San Francisco, CA"}, "destination": {"address": "Lake Tahoe, CA"}}}
- Example:
encoded_polyline(string): An encoded polyline representing aDRIVEroute.
travel_mode(enum - OPTIONAL):DRIVE(default),WALK, orBICYCLE.WALKandBICYCLEare only supported withroute_endpoints.TRANSITis not supported.routing_preference(enum - OPTIONAL):ROUTING_PREFERENCE_TRAFFIC_UNAWARE(default): computes the route and detours without live traffic. 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 traffic-adjusted detour times. It incurs higher latency.
include_extended_details(boolean - OPTIONAL): Set totrueonly when the request requires qualitative review insights, specific menu items or offerings, atmosphere, visitor tips or busyness, EV charger availability, gas prices, or other rich qualitative details. Defaults tofalse. Enabling it may increase latency.language_code(string - OPTIONAL): The language for the results summary and place details, e.g.,en,ja,en-US. Defaults toen-US.region_code(string - OPTIONAL): The Unicode CLDR region code of the user, e.g.,US,CA.
Instructions for Tool Call:
- Each result includes a
detour_summary(when available) describing the extra distance (localized_detour_distance) and, unless the route was given asencoded_polyline, the extra time (detour_duration) incurred by stopping at that place. Use it to compare options. - The response
summarymay contain zero-based citations (e.g., "[0]") referencing entries inresults. - The grounded output must be attributed to the source using the
attributionfield of eachresults[].placewhen available.
The following code sample shows how to use curl to call the search_along_route MCP tool.
| Curl Request |
|---|
curl --location 'https://mapstools.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_along_route", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for SearchAlongRoute.
SearchAlongRouteRequest
| JSON representation |
|---|
{ "textQuery": string, "languageCode": string, "regionCode": string, "routingPreference": enum ( |
| Fields | |
|---|---|
textQuery |
Required. Natural language search query (e.g., "ev chargers", "coffee"). |
languageCode |
Optional. The language for summary and place details. Defaults to "en-US". |
regionCode |
Optional. Country/region code (CLDR) of location (e.g., "US"). |
routingPreference |
Optional. Optional routing preference specifying how traffic data is used. Defaults to TRAFFIC_UNAWARE. |
includeExtendedDetails |
Optional. Includes extended place details in the response. Set this field to Leave Enabling this field may incur higher latency. |
travelMode |
Optional. Specifies the travel mode used to compute the route and the detours. Defaults to |
Union field route_spec. Route specification: either an existing route, route token, or origin/destination endpoints. route_spec can be only one of the following: |
|
encodedPolyline |
An encoded polyline string representing the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm |
retrievalToken |
A retrieval token returned from a prior ComputeRoutes call representing the route. |
routeEndpoints |
Explicit route endpoints (origin and destination). |
RouteEndpoints
| JSON representation |
|---|
{ "origin": { object ( |
| Fields | |
|---|---|
origin |
Required. Starting point (address, Place ID, or geographic coordinates). |
destination |
Required. Destination point (address, Place ID, or geographic coordinates). |
Waypoint
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field location_type. Different ways to represent a location. location_type can be only one of the following: |
|
latLng |
A point specified using geographic coordinates. |
placeId |
The Place ID associated with the waypoint. |
address |
Human readable address or a plus code. See https://plus.codes for details. |
LatLng
| JSON representation |
|---|
{ "latitude": number, "longitude": number } |
| Fields | |
|---|---|
latitude |
The latitude in degrees. It must be in the range [-90.0, +90.0]. |
longitude |
The longitude in degrees. It must be in the range [-180.0, +180.0]. |
RoutingPreference
A set of values that specify factors to take into consideration when calculating the route.
| Enums | |
|---|---|
ROUTING_PREFERENCE_UNSPECIFIED |
No routing preference specified. Defaults to ROUTING_PREFERENCE_TRAFFIC_UNAWARE. |
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. |
ROUTING_PREFERENCE_TRAFFIC_AWARE_OPTIMAL |
Calculates routes taking live traffic conditions into consideration, when traffic data is available. For This value will trigger the Pro tier and incur higher billing cost and latency. |
RouteTravelMode
A set of values used to specify the mode of travel.
| Enums | |
|---|---|
ROUTE_TRAVEL_MODE_UNSPECIFIED |
No travel mode specified. Defaults to DRIVE. |
DRIVE |
Travel by passenger car. |
WALK |
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. |
BICYCLE |
Travel by bicycle. |
TRANSIT |
Travel by public transit. |
Output Schema
Response message for SearchAlongRoute.
SearchAlongRouteResponse
| JSON representation |
|---|
{
"results": [
{
object ( |
| Fields | |
|---|---|
results[] |
Output only. The ranked list of search results found along the route. |
summary |
Output only. Natural language summary of search results and detour trade-offs. May contain zero-based citations (e.g. "[0]", "[1]") referencing the corresponding entries in the |
contentToken |
Output only. An encrypted token that encapsulates the search context and can be passed to Google Maps visual rendering services, SDKs, or the Maps Agentic UI Toolkit (A2UI) to display interactive UI components for the returned search results. |
Result
| JSON representation |
|---|
{ "place": { object ( |
| Fields | |
|---|---|
place |
Output only. Details about the place found along the route. |
detourSummary |
Output only. Detour metrics incurred by adding this place as an intermediate stop along the route. Omitted or empty if detour metrics could not be calculated. |
PlaceView
| JSON representation |
|---|
{ "place": string, "id": string, "googleMapsLinks": { object ( |
| Fields | |
|---|---|
place |
The resource name of the underlying place, in the format of "places/{id}". |
id |
The place ID of the underlying place. |
googleMapsLinks |
Links to trigger different Google Maps actions. |
attribution |
Required attribution to show with the place. |
Union field
|
|
location |
The position of this place. |
LatLng
| JSON representation |
|---|
{ "latitude": number, "longitude": number } |
| Fields | |
|---|---|
latitude |
The latitude in degrees. It must be in the range [-90.0, +90.0]. |
longitude |
The longitude in degrees. It must be in the range [-180.0, +180.0]. |
GoogleMapsLinks
| JSON representation |
|---|
{ "directionsUrl": string, "placeUrl": string, "writeAReviewUrl": string, "reviewsUrl": string, "photosUrl": string } |
| Fields | |
|---|---|
directionsUrl |
A link to show the directions to the place. The link only populates the destination location and uses the default travel mode |
placeUrl |
A link to show this place. |
writeAReviewUrl |
A link to write a review for this place on Google Maps. |
reviewsUrl |
A link to show reviews of this place on Google Maps. |
photosUrl |
A link to show photos of this place on Google Maps. |
Attribution
| JSON representation |
|---|
{ "title": string, "url": string } |
| Fields | |
|---|---|
title |
The title to display for the attribution. |
url |
The URL to link to for the attribution. |
DetourSummary
| JSON representation |
|---|
{ "detourDuration": string, "localizedDetourDistance": string } |
| Fields | |
|---|---|
detourDuration |
The additional travel time required to detour to this place from the main route. This value is not set if the route is specified by A duration in seconds with up to nine fractional digits, ending with ' |
localizedDetourDistance |
The additional distance required to detour to this place from the main route, formatted for display in the request language (e.g. "1.2 mi" or "1,9 km"). |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ✅ | Open World Hint: ❌