batch_geocode_locations
Geocode multiple location names to coordinates in a single concurrent request, reducing latency compared to sequential calls.
Instructions
Geocode multiple location names to coordinates in a single call.
Use this tool instead of calling geocode_location repeatedly when you need coordinates for multiple locations (e.g., "weather across the UK", "compare temperatures in European capitals").
This tool makes all geocoding requests concurrently, dramatically reducing latency compared to sequential calls. For N locations, this completes in roughly the time of 1 request instead of N sequential requests.
Args: names: Comma-separated list of location names to geocode. Examples: - "London,Paris,Berlin,Madrid,Rome" - "New York,Los Angeles,Chicago,Houston" - "Tokyo,Seoul,Beijing,Shanghai" Each name is searched independently. Whitespace around commas is trimmed. Maximum recommended: 50 locations per call. count: Maximum number of results per location (1-10). Default is 1. Use 1 when you know the exact locations (most common for batch). Use 3-5 for ambiguous names where you need to pick the right match. language: Language code for result names. Default is "en".
Returns: BatchGeocodingResponse: Contains: - results: List of BatchGeocodingItem, one per input location, in order. Each item has: query (original name), found (bool), results (list), error (str or None) - total_queries: How many locations were searched - successful: How many returned results - failed: How many returned no results or had errors
Tips for LLMs: - Use this FIRST when a user asks about weather in multiple places - After getting coordinates, pass them to batch_get_weather_forecasts - Partial failures are normal - some location names may not be found - Check the 'found' field on each item to identify failures - For failed items, try simpler search terms (just city name without region) - The results are in the SAME ORDER as the input names
Example: # Geocode 5 UK cities at once batch = await batch_geocode_locations("London,Manchester,Edinburgh,Cardiff,Belfast") # Extract coordinates for found locations coords = [(r.results[0].latitude, r.results[0].longitude) for r in batch.results if r.found]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | ||
| names | Yes | ||
| language | No | en |