Google maps

Learn how to use Google maps with Composio

Overview

SLUG: GOOGLE_MAPS

Description

Integrate Google Maps to access location data, geocoding, directions, and mapping services in your application.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to https://www.googleapis.com/auth/cloud-platform
generic_api_key
stringRequired

Connecting to Google maps

Create an auth config

Use the dashboard to create an auth config for the Google maps toolkit. This allows you to connect multiple Google maps accounts to Composio for agents to use.

1

Select App

Navigate to [Google maps](https://platform.composio.dev?next_page=/marketplace/Google maps).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Google maps Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4google_maps_auth_config_id = "ac_YOUR_GOOGLE_MAPS_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Google maps: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, google_maps_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4google_maps_auth_config_id = "ac_YOUR_GOOGLE_MAPS_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Google maps for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, google_maps_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Google maps toolkit’s playground](https://app.composio.dev/app/Google maps)

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Autocomplete Place Predictions

Description

Returns place and query predictions for text input. Use when implementing as-you-type autocomplete functionality for place searches. Returns up to five predictions ordered by relevance.

Action Parameters

includePureServiceAreaBusinesses
boolean
includeQueryPredictions
boolean
includedPrimaryTypes
array
includedRegionCodes
array
input
stringRequired
inputOffset
integer
languageCode
string
locationBias
object
locationRestriction
object
origin
object
regionCode
string
sessionToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Compute Route Matrix

Description

Calculates travel distance and duration matrix between multiple origins and destinations using the modern Routes API; supports OAuth2 authentication and various travel modes.

Action Parameters

destinations
arrayRequired
fieldMask
stringDefaults to originIndex,destinationIndex,duration,distanceMeters,status,condition
languageCode
stringDefaults to en-US
origins
arrayRequired
routingPreference
stringDefaults to TRAFFIC_AWARE
travelMode
stringDefaults to DRIVE
units
stringDefaults to IMPERIAL

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Distance Matrix (Legacy)

Description

DEPRECATED: Legacy API that calculates travel distance and time for a matrix of origins and destinations. This API only works with API keys (no OAuth2 support). Use the modern 'Compute Route Matrix' action instead, which supports OAuth2 authentication. Supports different modes of transportation and options like departure/arrival times.

Action Parameters

arrival_time
integer
avoid
string
departure_time
integer
destinations
stringRequired
key
string
language
string
mode
stringDefaults to driving
origins
stringRequired
region
string
traffic_model
string
transit_mode
string
transit_routing_preference
string
units
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geocode Address

Description

DEPRECATED: Legacy API to convert street addresses into geographic coordinates (latitude and longitude). This API works best with API key authentication. For OAuth connections without an API key, you may need to provide the 'key' parameter or use the newer 'Text Search' action instead. Use when you need to geocode an address or location to get its precise latitude/longitude coordinates.

Action Parameters

address
string
bounds
string
components
string
key
string
language
string
region
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geocode Address With Query

Description

Tool to map addresses to geographic coordinates with query parameter. Use when you need to convert a textual address into latitude/longitude coordinates using the modern v4beta API.

Action Parameters

address_query
stringRequired
language_code
string
region_code
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geocode Destinations

Description

Tool to perform destination lookup and return detailed destination information including primary place, containing places, sub-destinations, landmarks, entrances, and navigation points. Use when you need comprehensive destination data for an address, place ID, or geographic coordinates.

Action Parameters

addressQuery
object
languageCode
string
locationQuery
object
place
string
regionCode
string
travelModes
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reverse Geocode Location

Description

Tool to convert geographic coordinates (latitude and longitude) to human-readable addresses using reverse geocoding. Use when you need to find the address or place name for a given set of coordinates.

Action Parameters

languageCode
string
latitude
numberRequired
longitude
numberRequired
regionCode
string
types
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reverse Geocode Location With Query

Description

Tool to convert geographic coordinates to human-readable addresses using a location query parameter. Use when you need reverse geocoding with coordinates in a single string format.

Action Parameters

granularity
array
languageCode
string
locationQuery
stringRequired
regionCode
string
types
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geocode Place by ID

Description

Tool to perform geocode lookup using a place identifier to retrieve address and coordinates. Use when you need to get detailed geographic information for a specific Google Place ID.

Action Parameters

languageCode
string
place_id
stringRequired
regionCode
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geocoding API (Legacy)

Description

DEPRECATED: Legacy API to convert addresses into geographic coordinates (latitude and longitude) and vice versa (reverse geocoding), or get an address for a Place ID. This API only works with API keys (no OAuth2 support). Consider using the modern Places API (Text Search or Nearby Search) for similar functionality with OAuth2 authentication.

Action Parameters

address
string
bounds
string
components
string
extra_computations
array
key
string
language
string
latlng
string
location_type
string
place_id
string
region
string
result_type
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Geolocate Device

Description

Tool to determine location based on cell towers and WiFi access points. Use when you need to find the geographic location of a device using network infrastructure data.

Action Parameters

carrier
string
cellTowers
array
considerIp
booleanDefaults to True
homeMobileCountryCode
integer
homeMobileNetworkCode
integer
radioType
string
wifiAccessPoints
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get 2D Map Tile

Description

Tool to retrieve a 2D map tile image at specified coordinates for building custom map visualizations. Use when you need to download individual map tile images for roadmap, satellite, or terrain views. Requires a valid session token from the createSession endpoint.

Action Parameters

key
string
orientation
integer
session
stringRequired
x
integerRequired
y
integerRequired
z
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get 3D Tiles Root

Description

Tool to retrieve the 3D Tiles tileset root configuration for photorealistic 3D map rendering. Use when you need to initialize a 3D renderer with Google's photorealistic tiles following the OGC 3D Tiles specification.

Action Parameters

key
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Directions (Legacy)

Description

DEPRECATED: Legacy API that fetches detailed directions between an origin and a destination, supporting intermediate waypoints and various travel modes. This API only works with API keys (no OAuth2 support). Use the modern 'Get Route' action instead, which supports OAuth2 authentication.

Action Parameters

avoid
string
destination
stringRequired
language
stringDefaults to en
mode
stringDefaults to driving
origin
stringRequired
units
stringDefaults to imperial
waypoints
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Place Details

Description

Retrieves comprehensive details for a place using its resource name (places/{place_id} format). Use when you need detailed information about a specific place.

Action Parameters

fieldMask
stringDefaults to id,displayName,formattedAddress
languageCode
string
name
stringRequired
regionCode
string
sessionToken
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Route

Description

Calculates one or more routes between two specified locations. Uses various travel modes and preferences; addresses must be resolvable by Google Maps.

Action Parameters

computeAlternativeRoutes
boolean
destination_address
stringRequired
fieldMask
stringDefaults to routes.distanceMeters,routes.duration,routes.polyline.encodedPolyline
languageCode
stringDefaults to en-US
origin_address
stringRequired
routeModifiers_avoidFerries
boolean
routeModifiers_avoidHighways
boolean
routeModifiers_avoidTolls
boolean
routingPreference
string
travelMode
stringDefaults to DRIVE
units
stringDefaults to IMPERIAL

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Embed Google Map

Description

Tool to generate an embeddable Google Map URL and HTML iframe code. Use when you need to display a map (place, view, directions, street view, search) on a webpage without JavaScript. Note: This API only works with API keys (no OAuth2 support). It generates embed URLs and does not make direct API calls.

Action Parameters

directions_params
object
mode
stringRequired
place_params
object
search_params
object
streetview_params
object
view_params
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Place Photo

Description

Retrieves high quality photographic content from the Google Maps Places database. Use when you need to download a place photo using a photo_reference obtained from Place Details, Nearby Search, or Text Search requests. Images are scaled proportionally to fit within specified dimensions.

Action Parameters

maxheight
integer
maxwidth
integer
photo_reference
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Tiles Session

Description

Tool to create a session token required for accessing 2D Tiles and Street View imagery. Use when you need to initialize tile-based map rendering or street view display. The session token is valid for approximately two weeks and must be included in all subsequent tile requests.

Action Parameters

highDpi
boolean
imageFormat
string
language
stringRequired
layerTypes
array
mapType
stringRequired
overlay
boolean
region
stringRequired
scale
string
styles
array

Action Response

data
objectRequired
error
string
successful
booleanRequired