Query Gemini with Google Maps grounding
Get location-aware AI responses by querying Gemini with Google Maps grounding for restaurants, hotels, attractions, and other place-based recommendations with accurate, up-to-date information. Use when you need location-specific recommendations or place information.
/plugin marketplace add dnvriend/gemini-google-maps-tool/plugin install gemini-google-maps-tool@gemini-google-maps-toolThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Comprehensive guide for using gemini-google-maps-tool, a CLI and Python library that connects Gemini to Google Maps' database of 250+ million places worldwide for location-aware responses with accurate, up-to-date information.
Use this skill when:
Do NOT use this skill for:
A production-ready CLI and Python library for querying Gemini with Google Maps grounding.
# Install globally with uv tool
uv tool install gemini-google-maps-tool
# Or from source
git clone https://github.com/dnvriend/gemini-google-maps-tool.git
cd gemini-google-maps-tool
uv tool install .
# Set API key
export GEMINI_API_KEY="your-api-key"
# Basic query
gemini-google-maps-tool query "Best coffee shops in Amsterdam"
# With location context
gemini-google-maps-tool query "Italian restaurants nearby" \
--lat-lon "52.37,4.89"
# Markdown output with sources
gemini-google-maps-tool query "Museums in Paris" --text
Query Gemini with Google Maps integration for location-aware information about places, businesses, directions, and attractions.
Usage:
gemini-google-maps-tool query "QUERY" [OPTIONS]
Arguments:
QUERY: The search query (required unless using --stdin)--lat-lon LAT,LON: Location coordinates in format "lat,lon" (e.g., "37.78193,-122.40476")--model {flash|flash-lite}: Model selection
flash: gemini-2.5-flash (more powerful, higher cost)flash-lite: gemini-2.5-flash-lite (default, faster, cost-effective)-v, --verbose: Enable INFO logging (operation-level details)-vv: Enable DEBUG logging (detailed API calls, validation)-vvv: Enable TRACE logging (full HTTP traces, library internals)--text / -t: Output markdown text instead of JSON--stdin / -s: Read query from stdinExamples:
# Basic query
gemini-google-maps-tool query "Best coffee shops in Amsterdam"
# With location context
gemini-google-maps-tool query "Italian restaurants nearby" \
--lat-lon "52.37,4.89"
# Using different model
gemini-google-maps-tool query "Plan a day in NYC" --model flash
# Markdown output with sources
gemini-google-maps-tool query "Best museums in Paris" --text
# Verbose mode with grounding metadata
gemini-google-maps-tool query "Sushi restaurants" -v
# Debug mode with full details
gemini-google-maps-tool query "Hotels in London" -vv
# Trace mode with HTTP details
gemini-google-maps-tool query "Attractions in Rome" -vvv
# Reading from stdin (for pipelines)
echo "Best bakeries in San Francisco" | \
gemini-google-maps-tool query --stdin
# Pipeline with jq
gemini-google-maps-tool query "Coffee shops" | \
jq '.response_text'
Output Formats:
JSON (default):
{
"response_text": "Here are some great coffee shops...",
"grounding_metadata": {
"grounding_chunks": [
{
"title": "Blue Bottle Coffee",
"uri": "https://maps.google.com/?cid=...",
"place_id": "places/ChIJ..."
}
]
}
}
Markdown (with --text):
Here are some great coffee shops...
---
## Sources
1. [Blue Bottle Coffee](https://maps.google.com/?cid=...)
2. [Philz Coffee](https://maps.google.com/?cid=...)
Generate shell completion scripts for Bash, Zsh, or Fish to enable tab-completion for commands and options.
Usage:
gemini-google-maps-tool completion {bash|zsh|fish}
Arguments:
SHELL: Shell type (required) - bash, zsh, or fishExamples:
# Bash - temporary (current session)
eval "$(gemini-google-maps-tool completion bash)"
# Bash - persistent
echo 'eval "$(gemini-google-maps-tool completion bash)"' >> ~/.bashrc
# Zsh - temporary
eval "$(gemini-google-maps-tool completion zsh)"
# Zsh - persistent
echo 'eval "$(gemini-google-maps-tool completion zsh)"' >> ~/.zshrc
# Fish - install to completions directory
gemini-google-maps-tool completion fish > \
~/.config/fish/completions/gemini-google-maps-tool.fish
# File-based (better performance)
gemini-google-maps-tool completion bash > \
~/.gemini-google-maps-tool-complete.bash
echo 'source ~/.gemini-google-maps-tool-complete.bash' >> ~/.bashrc
Output: Shell-specific completion script that can be evaluated or saved to a file.
</details> <details> <summary><strong>⚙️ Advanced Features (Click to expand)</strong></summary>Progressive detail control for debugging and monitoring:
-v: INFO level - high-level operations, important events-vv: DEBUG level - detailed operations, API calls, validation steps-vvv: TRACE level - full request/response, library internals, HTTP tracesExamples:
# INFO: See which files are processed
gemini-google-maps-tool query "Best restaurants" -v
# DEBUG: See API call details and validation
gemini-google-maps-tool query "Hotels nearby" -vv
# TRACE: See full HTTP requests/responses
gemini-google-maps-tool query "Museums" -vvv
What is it? Google Maps grounding connects Gemini to Google Maps' database of 250+ million places worldwide, providing:
Grounding Metadata:
With -v or --text, responses include:
Example:
gemini-google-maps-tool query "Best pizza in Brooklyn" -v
Returns JSON with:
{
"response_text": "...",
"grounding_metadata": {
"grounding_chunks": [
{
"title": "Roberta's Pizza",
"uri": "https://maps.google.com/?cid=...",
"place_id": "places/ChIJ..."
}
],
"grounding_supports": [...],
"google_maps_widget_context_token": "..."
}
}
Provide location coordinates for personalized, location-aware responses:
Format: --lat-lon "latitude,longitude"
Examples:
# Amsterdam center
gemini-google-maps-tool query "Coffee shops nearby" \
--lat-lon "52.37,4.89"
# San Francisco
gemini-google-maps-tool query "Italian restaurants" \
--lat-lon "37.78,-122.40"
# Tokyo
gemini-google-maps-tool query "Sushi restaurants" \
--lat-lon "35.68,139.76"
Coordinate Ranges:
Choose between two Gemini models:
flash-lite (default):
flash:
Examples:
# Default (flash-lite)
gemini-google-maps-tool query "Best restaurants"
# Explicit flash-lite
gemini-google-maps-tool query "Hotels" --model flash-lite
# Use flash for complex queries
gemini-google-maps-tool query "Plan a 3-day trip to Paris" \
--model flash
Import and use programmatically in Python applications:
Basic Usage:
from gemini_google_maps_tool import get_client, query_maps
# Initialize client
client = get_client()
# Execute query
result = query_maps(
client=client,
query="Best coffee shops near me",
)
print(result.response_text)
With Location and Grounding:
from gemini_google_maps_tool import get_client, query_maps
client = get_client()
result = query_maps(
client=client,
query="Italian restaurants nearby",
lat_lon=(37.78193, -122.40476),
model="gemini-2.5-flash",
include_grounding=True,
)
# Access response
print(result.response_text)
# Access grounding metadata
if result.grounding_metadata:
for chunk in result.grounding_metadata.grounding_chunks:
print(f"Source: {chunk.title} - {chunk.uri}")
Error Handling:
from gemini_google_maps_tool import (
get_client,
query_maps,
ClientError,
QueryError,
)
try:
client = get_client()
result = query_maps(client, "Best restaurants")
print(result.response_text)
except ClientError as e:
print(f"Client error: {e}")
except QueryError as e:
print(f"Query error: {e}")
</details>
<details>
<summary><strong>🔧 Troubleshooting (Click to expand)</strong></summary>
Issue: GEMINI_API_KEY not set
Error: GEMINI_API_KEY environment variable is required.
Solution:
# Set for current session
export GEMINI_API_KEY="your-api-key"
# Or add to shell profile
echo 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrc
source ~/.zshrc
# Or retrieve from macOS Keychain
export GEMINI_API_KEY=$(security find-generic-password \
-a "production" -s "GEMINI_API_KEY" -w)
Issue: Invalid lat-lon format
ValueError: Invalid lat-lon format
Solution:
# Correct
gemini-google-maps-tool query "restaurants" --lat-lon "52.37,4.89"
# Incorrect
gemini-google-maps-tool query "restaurants" --lat-lon "52.37 4.89"
gemini-google-maps-tool query "restaurants" --lat-lon "200,50"
Issue: API returns no response candidates
QueryError: API returned no response candidates
Possible causes:
Solution:
Issue: Empty response text
QueryError: API returned empty response text
Possible causes:
Solution:
# Main help
gemini-google-maps-tool --help
# Command-specific help
gemini-google-maps-tool query --help
gemini-google-maps-tool completion --help
# Version information
gemini-google-maps-tool --version
Enable verbose logging to diagnose issues:
# INFO level
gemini-google-maps-tool query "test" -v
# DEBUG level (detailed)
gemini-google-maps-tool query "test" -vv
# TRACE level (full HTTP traces)
gemini-google-maps-tool query "test" -vvv
</details>
JSON (default):
response_text fieldgrounding_metadata with -vMarkdown (--text):
--lat-lon when asking about specific areasflash-lite (default) for simple queries, flash for complex tasks-v, -vv, or -vvv to understand what's happeningLearn more: Gemini API Pricing