Skip to main content
Glama
garylab

Serper MCP Server

by garylab

google_search_autocomplete

Perform Google searches through the Serper MCP Server to retrieve current web information for queries, with options for location, language, and autocorrection.

Instructions

Search Google for results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesThe query to search for
glNoThe country to search in, e.g. us, uk, ca, au, etc.
locationNoThe location to search in, e.g. San Francisco, CA, USA
hlNoThe language to search in, e.g. en, es, fr, de, etc.
pageNoThe page number to return, first page is 1 (integer value as string)1
autocorrectNoAutomatically correct (boolean value as string: 'true' or 'false')true

Implementation Reference

  • Core handler function for the google_search_autocomplete tool. Extracts 'autocomplete' from tool name, builds Serper API URL, and fetches the response using the provided request.
    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 for the google_search_autocomplete tool, extending BaseRequest with 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')",
        )
  • Registers the google_search_autocomplete tool (via google_request_map) by creating a Tool object with name, description, and inputSchema from AutocorrectRequest.
    @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
  • Maps the SerperTools.GOOGLE_SEARCH_AUTOCOMPLETE enum to AutocorrectRequest schema, used by list_tools() and call_tool() for this 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,
    }
  • Dispatch logic in the main MCP call_tool handler that invokes the google handler for google_search_autocomplete using the mapped schema and tool enum.
    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")]
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Search Google for results' provides zero information about what the tool actually does: Does it return autocomplete suggestions? Full search results? How many results? What format? Are there rate limits? Authentication requirements? The description offers no behavioral context beyond the most basic verb+resource statement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise at just 4 words. While this conciseness comes at the expense of clarity and completeness, the description itself contains zero wasted words and is perfectly front-loaded. Every word serves the core purpose of stating what the tool does, albeit inadequately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 6 parameters, no annotations, no output schema, and 11 sibling tools, the description is completely inadequate. It fails to explain what the tool returns, how it differs from alternatives, or any behavioral characteristics. For a tool that presumably returns search results (though even this is unclear), the description provides insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with all 6 parameters well-documented in the schema itself. The description adds no parameter information beyond what's already in the structured schema. Since the schema does the heavy lifting, the baseline score of 3 is appropriate - the description neither adds value nor detracts from parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Search Google for results' is a tautology that restates the tool name 'google_search_autocomplete' without adding specificity. It doesn't clarify what 'autocomplete' means in this context or distinguish this tool from its many siblings (e.g., google_search, google_search_images). The description fails to specify what type of search results are returned or what makes this tool unique.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides absolutely no guidance on when to use this tool versus its 11 sibling tools. With multiple specialized Google search tools available (images, maps, news, scholar, etc.), the agent receives no indication of what makes 'autocomplete' different or when it should be selected over the generic 'google_search' tool. This creates significant ambiguity in tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/garylab/serper-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server