Tool: compute_routes
Computes a travel route between a specified origin and destination. Supported Travel Modes: DRIVE (default), WALK.
Input Requirements (CRITICAL): Requires both origin and destination. Each must be provided using one of the following methods, nested within its respective field:
address: (string, e.g., 'Eiffel Tower, Paris'). Note: The more granular or specific the input address is, the better the results will be.
lat_lng: (object, {"latitude": number, "longitude": number})
place_id: (string, e.g., 'ChIJOwE_Id1w5EAR4Q27FkL6T_0') Note: This id can be obtained from the search_places tool. Any combination of input types is allowed (e.g., origin by address, destination by lat_lng). If either the origin or destination is missing, you MUST ask the user for clarification before attempting to call the tool.
Example Tool Call: {"origin":{"address":"Eiffel Tower"},"destination":{"place_id":"ChIJt_5xIthw5EARoJ71mGq7t74"},"travel_mode":"DRIVE"}
- The grounded output must be attributed to the source using the information from the
attributionfield when available.
The following code sample shows how to use curl to call the compute_routes 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": "compute_routes", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
ComputeRoutesRequest.
ComputeRoutesRequest
| JSON representation |
|---|
{ "origin": { object ( |
| Fields | |
|---|---|
origin |
Required. Origin waypoint. |
destination |
Required. Destination waypoint. |
travelMode |
Optional. Specifies the mode of transportation. |
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]. |
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. |
Output Schema
ComputeRoutesResponse.
ComputeRoutesResponse
| JSON representation |
|---|
{
"routes": [
{
object ( |
| Fields | |
|---|---|
routes[] |
Contains routes between the requested origin and destination. Currently only one route is returned. |
Route
| JSON representation |
|---|
{
"distanceMeters": integer,
"duration": string,
"attribution": {
object ( |
| Fields | |
|---|---|
distanceMeters |
The travel distance of the route, in meters. |
duration |
The length of time needed to navigate the route. A duration in seconds with up to nine fractional digits, ending with ' |
attribution |
Required attribution to show with the route. |
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 |
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. |
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: ❌