google_search_shopping
Retrieve shopping results from Google by entering a query, specifying location, language, and page number. Optimize searches with autocomplete and result count adjustments for tailored product discovery.
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 | |
| num | No | The number of results to return, max is 100 | |
| 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 by deriving the API endpoint ('/shopping' for google_search_shopping) from the tool name and calling 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 specific to the google_search_shopping tool, extending BaseRequest with autocorrect and num fields.class ShoppingRequest(BaseRequest): autocorrect: Optional[str] = Field( "true", pattern=r"^(true|false)$", description="Automatically correct (boolean value as string: 'true' or 'false')", ) num: str = Field( "10", pattern=r"^([1-9]|[1-9]\d|100)$", description="The number of results to return, max is 100 (integer value as string)", )
- src/serper_mcp_server/server.py:25-38 (registration)Mapping of tool enums to their respective request schemas, used for both tool registration and call dispatch; includes google_search_shopping -> ShoppingRequest.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-61 (registration)Registers all Google search tools, including google_search_shopping, with MCP by providing name and inputSchema from the mapped request models.@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:12-12 (helper)Enum value defining the exact tool name string 'google_search_shopping'.GOOGLE_SEARCH_SHOPPING = "google_search_shopping"