google_search_maps
Search Google Maps for locations, businesses, and directions using GPS coordinates, place IDs, or country-specific queries to find geographic information.
Instructions
Search Google for results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | The query to search for | |
| ll | No | The GPS position & zoom level | |
| placeId | No | The place ID to search in | |
| cid | No | The CID to search in | |
| gl | No | The country to search in, e.g. us, uk, ca, au, etc. | |
| hl | No | The language to search in, e.g. en, es, fr, de, etc. | |
| page | No | The page number to return, first page is 1 (integer value as string) | 1 |
Implementation Reference
- src/serper_mcp_server/server.py:62-81 (handler)MCP server call_tool handler that validates arguments with MapsRequest (via google_request_map), instantiates SerperTools.GOOGLE_SEARCH_MAPS, and calls the google core function to execute the tool.@server.call_tool() async def call_tool(name: str, arguments: dict[str, Any]) -> Sequence[TextContent | ImageContent | EmbeddedResource]: if not SERPER_API_KEY: return [TextContent(text=f"SERPER_API_KEY is empty!", type="text")] try: if name == SerperTools.WEBPAGE_SCRAPE.value: request = WebpageRequest(**arguments) result = await scape(request) return [TextContent(text=json.dumps(result, indent=2), type="text")] if not SerperTools.has_value(name): raise ValueError(f"Tool {name} not found") tool = SerperTools(name) request = google_request_map[tool](**arguments) result = await google(tool, request) return [TextContent(text=json.dumps(result, indent=2), type="text")] except Exception as e: return [TextContent(text=f"Error: {str(e)}", type="text")]
- src/serper_mcp_server/core.py:14-18 (handler)Core handler logic for google_search_maps: derives endpoint '/maps' from tool name and calls Serper API via fetch_json.async def google(tool: SerperTools, request: BaseModel) -> Dict[str, Any]: uri_path = tool.value.split("_")[-1] url = f"https://google.serper.dev/{uri_path}" return await fetch_json(url, request)
- Pydantic model defining the input schema (parameters and validation) for the google_search_maps tool.class MapsRequest(BaseModel): q: str = Field(..., description="The query to search for") ll: Optional[str] = Field(None, description="The GPS position & zoom level") placeId: Optional[str] = Field(None, description="The place ID to search in") cid: Optional[str] = Field(None, description="The CID to search in") gl: Optional[str] = Field( None, description="The country to search in, e.g. us, uk, ca, au, etc." ) hl: Optional[str] = Field( None, description="The language to search in, e.g. en, es, fr, de, etc." ) page: Optional[str] = Field( "1", pattern=r"^[1-9]\d*$", description="The page number to return, first page is 1 (integer value as string)", )
- src/serper_mcp_server/server.py:25-38 (registration)Dictionary mapping SerperTools enum values (including GOOGLE_SEARCH_MAPS) to their corresponding request schemas, used for tool registration in list_tools() and dispatch in call_tool().google_request_map = { SerperTools.GOOGLE_SEARCH: SearchRequest, SerperTools.GOOGLE_SEARCH_IMAGES: SearchRequest, SerperTools.GOOGLE_SEARCH_VIDEOS: SearchRequest, SerperTools.GOOGLE_SEARCH_PLACES: AutocorrectRequest, SerperTools.GOOGLE_SEARCH_MAPS: MapsRequest, SerperTools.GOOGLE_SEARCH_REVIEWS: ReviewsRequest, SerperTools.GOOGLE_SEARCH_NEWS: SearchRequest, SerperTools.GOOGLE_SEARCH_SHOPPING: ShoppingRequest, SerperTools.GOOGLE_SEARCH_LENS: LensRequest, SerperTools.GOOGLE_SEARCH_SCHOLAR: AutocorrectRequest, SerperTools.GOOGLE_SEARCH_PATENTS: PatentsRequest, SerperTools.GOOGLE_SEARCH_AUTOCOMPLETE: AutocorrectRequest, }
- src/serper_mcp_server/enums.py:9-9 (helper)Enum definition providing the exact tool name string 'google_search_maps' used for registration and dispatch.GOOGLE_SEARCH_MAPS = "google_search_maps"