Skip to main content
Glama
garylab

Serper MCP Server

by garylab

google_search_maps

Search Google Maps for locations, businesses, and directions using GPS coordinates, place IDs, or country-specific queries to find geographic information.

Instructions

Search Google for results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesThe query to search for
llNoThe GPS position & zoom level
placeIdNoThe place ID to search in
cidNoThe CID to search in
glNoThe country to search in, e.g. us, uk, ca, au, etc.
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

Implementation Reference

  • MCP server call_tool handler that validates arguments with MapsRequest (via google_request_map), instantiates SerperTools.GOOGLE_SEARCH_MAPS, and calls the google core function to execute the tool.
    @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")]
  • Core handler logic for google_search_maps: derives endpoint '/maps' from tool name and calls 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 model defining the input schema (parameters and validation) for the google_search_maps tool.
    class MapsRequest(BaseModel):
        q: str = Field(..., description="The query to search for")
        ll: Optional[str] = Field(None, description="The GPS position & zoom level")
        placeId: Optional[str] = Field(None, description="The place ID to search in")
        cid: Optional[str] = Field(None, description="The CID to search in")
        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."
        )
        page: Optional[str] = Field(
            "1",
            pattern=r"^[1-9]\d*$",
            description="The page number to return, first page is 1 (integer value as string)",
        )
  • Dictionary mapping SerperTools enum values (including GOOGLE_SEARCH_MAPS) to their corresponding request schemas, used for tool registration in list_tools() and dispatch 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,
    }
  • Enum definition providing the exact tool name string 'google_search_maps' used for registration and dispatch.
    GOOGLE_SEARCH_MAPS = "google_search_maps"
Behavior1/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but provides none. It doesn't mention whether this is a read-only operation, what kind of results to expect (maps data vs general web results), rate limits, authentication requirements, or any behavioral characteristics. The description is completely silent on how the tool behaves beyond the basic 'search' action.

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 extremely concise at just three words. While this represents under-specification rather than ideal conciseness, according to the scoring guidelines, 'Process' received a 2 for conciseness, and this is even more minimal. However, every word earns its place - there's no wasted text or redundancy. The structure is front-loaded but lacks substance.

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?

For a tool with 7 parameters, no annotations, no output schema, and 11 sibling tools, the description is completely inadequate. It doesn't explain what makes this a 'maps' search versus other Google searches, what type of results to expect, or when to use it. The agent would struggle to understand this tool's role in the broader toolset or how to use it effectively.

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%, so all parameters are documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema. According to the scoring guidelines, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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_maps' without specifying what makes this tool unique. It doesn't mention maps specifically or distinguish this from sibling tools like google_search, google_search_places, or google_search_reviews. The purpose remains vague about what type of Google search this performs.

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?

There is absolutely no guidance about when to use this tool versus the 11 other Google search siblings or the webpage_scrape tool. The description provides no context about appropriate use cases, prerequisites, or alternatives. This leaves the agent with no way to determine which search tool to select for a given task.

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