google_search_reviews
Retrieve Google reviews and ratings for specific places or topics using the Serper MCP Server. Filter by location, language, and sort order to access relevant data for analysis or insights.
Instructions
Search Google for results
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cid | No | The CID to search in | |
| fid | Yes | The FID | |
| 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. | |
| nextPageToken | No | The next page token to use | |
| placeId | No | The place ID to search in | |
| sortBy | No | The sort order to use | mostRelevant |
| topicId | No | The topic ID to search in |
Input Schema (JSON Schema)
{
"$defs": {
"ReviewSortBy": {
"enum": [
"mostRelevant",
"newest",
"highestRating",
"lowestRating"
],
"title": "ReviewSortBy",
"type": "string"
}
},
"properties": {
"cid": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The CID to search in",
"title": "Cid"
},
"fid": {
"description": "The FID",
"title": "Fid",
"type": "string"
},
"gl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The country to search in, e.g. us, uk, ca, au, etc.",
"title": "Gl"
},
"hl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The language to search in, e.g. en, es, fr, de, etc.",
"title": "Hl"
},
"nextPageToken": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The next page token to use",
"title": "Nextpagetoken"
},
"placeId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The place ID to search in",
"title": "Placeid"
},
"sortBy": {
"anyOf": [
{
"$ref": "#/$defs/ReviewSortBy"
},
{
"type": "null"
}
],
"default": "mostRelevant",
"description": "The sort order to use"
},
"topicId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The topic ID to search in",
"title": "Topicid"
}
},
"required": [
"fid"
],
"title": "ReviewsRequest",
"type": "object"
}
Implementation Reference
- src/serper_mcp_server/core.py:14-18 (handler)Handler function that implements the core logic for the 'google_search_reviews' tool (and other Google tools). It extracts the endpoint ('reviews') from the tool name and calls the 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 schema/model for input validation of the 'google_search_reviews' tool.class ReviewsRequest(BaseModel): fid: str = Field(..., description="The FID") cid: Optional[str] = Field(None, description="The CID to search in") placeId: Optional[str] = Field(None, description="The place ID to search in") sortBy: Optional[str] = Field( "mostRelevant", pattern=r"^(mostRelevant|newest|highestRating|lowestRating)$", description="The sort order to use (enum value as string: 'mostRelevant', 'newest', 'highestRating', 'lowestRating')", ) topicId: Optional[str] = Field(None, description="The topic ID to search in") nextPageToken: Optional[str] = Field(None, description="The next page token to use") 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." )
- src/serper_mcp_server/server.py:25-38 (registration)Dictionary mapping tool enums to their corresponding request schemas, used for tool registration in list_tools() and request creation 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/core.py:25-40 (helper)Helper function that performs the actual HTTP POST request to the Serper API endpoint with authentication and returns the JSON response.async def fetch_json(url: str, request: BaseModel) -> Dict[str, Any]: payload = request.model_dump(exclude_none=True) headers = { 'X-API-KEY': SERPER_API_KEY, 'Content-Type': 'application/json' } ssl_context = ssl.create_default_context(cafile=certifi.where()) connector = aiohttp.TCPConnector(ssl=ssl_context) timeout = aiohttp.ClientTimeout(total=AIOHTTP_TIMEOUT) async with aiohttp.ClientSession(connector=connector, timeout=timeout) as session: async with session.post(url, headers=headers, json=payload) as response: response.raise_for_status() return await response.json()
- src/serper_mcp_server/enums.py:4-18 (registration)StrEnum defining all tool names, including 'google_search_reviews', used for validation and dispatch.class SerperTools(StrEnum): GOOGLE_SEARCH = "google_search" GOOGLE_SEARCH_IMAGES = "google_search_images" GOOGLE_SEARCH_VIDEOS = "google_search_videos" GOOGLE_SEARCH_PLACES = "google_search_places" GOOGLE_SEARCH_MAPS = "google_search_maps" GOOGLE_SEARCH_REVIEWS = "google_search_reviews" GOOGLE_SEARCH_NEWS = "google_search_news" GOOGLE_SEARCH_SHOPPING = "google_search_shopping" GOOGLE_SEARCH_LENS = "google_search_lens" GOOGLE_SEARCH_SCHOLAR = "google_search_scholar" GOOGLE_SEARCH_PATENTS = "google_search_patents" GOOGLE_SEARCH_AUTOCOMPLETE = "google_search_autocomplete" WEBPAGE_SCRAPE = "webpage_scrape"