google_search_scholar
Access up-to-date Google search results via Serper MCP Server, enabling precise web queries with customizable language, location, and page parameters for targeted information retrieval.
Instructions
Search Google for results
Input 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 |
Input Schema (JSON Schema)
{
"properties": {
"autocorrect": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": true,
"description": "Automatically correct",
"title": "Autocorrect"
},
"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"
},
"location": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The location to search in, e.g. San Francisco, CA, USA",
"title": "Location"
},
"page": {
"anyOf": [
{
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"default": 1,
"description": "The page number to return, first page is 1",
"title": "Page"
},
"q": {
"description": "The query to search for",
"title": "Q",
"type": "string"
}
},
"required": [
"q"
],
"title": "AutocorrectRequest",
"type": "object"
}
Implementation Reference
- src/serper_mcp_server/core.py:14-17 (handler)Core handler function that executes the google_search_scholar tool by deriving the endpoint 'scholar' from the tool name and calling 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 input schema model used for the google_search_scholar tool, extending BaseRequest with 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)Dictionary mapping tool names (SerperTools enum) to input schema classes; maps GOOGLE_SEARCH_SCHOLAR to AutocorrectRequest for use in registration and dispatch.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 list_tools handler that registers the google_search_scholar tool with its schema and description.@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/server.py:62-81 (handler)Top-level MCP call_tool handler that dispatches google_search_scholar calls to the google() function after schema validation.@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")]