google_search_autocomplete
Retrieve autocomplete suggestions for Google searches to enhance query accuracy. Supports location, language, and autocorrection settings for precise results.
Instructions
Search Google for results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| autocorrect | No | Automatically correct | |
| 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. | |
| location | No | The location to search in, e.g. San Francisco, CA, USA | |
| page | No | The page number to return, first page is 1 | |
| q | Yes | The query to search for |
Implementation Reference
- src/serper_mcp_server/core.py:14-18 (handler)Executes the tool logic for google_search_autocomplete (and other Google tools) by deriving the API endpoint '/autocomplete' from the tool name and posting the request to the Serper API.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 input schema for the google_search_autocomplete tool, inheriting from BaseRequest (query, location, etc.) and adding an autocorrect option.class AutocorrectRequest(BaseRequest): autocorrect: Optional[str] = Field( "true", pattern=r"^(true|false)$", description="Automatically correct (boolean value as string: 'true' or 'false')", )
- src/serper_mcp_server/server.py:25-38 (registration)Maps SerperTools enum values (including GOOGLE_SEARCH_AUTOCOMPLETE) to input schema classes for use in tool registration and dispatching.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/server.py:41-60 (registration)MCP server decorator that lists all tools, including google_search_autocomplete, providing name, description, and input schema.@server.list_tools() async def list_tools() -> List[Tool]: tools = [] for k, v in google_request_map.items(): tools.append( Tool( name=k.value, description="Search Google for results", inputSchema=v.model_json_schema(), ), ) tools.append(Tool( name=SerperTools.WEBPAGE_SCRAPE, description="Scrape webpage by url", inputSchema=WebpageRequest.model_json_schema(), )) return tools
- src/serper_mcp_server/enums.py:16-16 (helper)Enum constant defining the tool name string 'google_search_autocomplete' used throughout the codebase.GOOGLE_SEARCH_AUTOCOMPLETE = "google_search_autocomplete"