Skip to main content
Glama
garylab

Serper MCP Server

by garylab

google_search_shopping

Search Google Shopping to find product listings, compare prices, and retrieve shopping results with customizable country, location, and language filters.

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
numNoThe number of results to return, max is 100 (integer value as string)10

Implementation Reference

  • Enum definition of the tool name 'google_search_shopping' as a SerperTools member
    GOOGLE_SEARCH_SHOPPING = "google_search_shopping"
  • Registration of the tool in the google_request_map, mapping the enum to ShoppingRequest schema. The tool is then registered in list_tools() via iteration.
    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,
    }
  • Generic call_tool handler that dispatches to the google() core function for any google search tool, including google_search_shopping. It looks up the request schema from google_request_map and calls google(tool, request).
    @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")]
  • The google() async function that constructs the API URL by extracting the last segment of the tool enum value (e.g., 'shopping' from 'google_search_shopping') and calls fetch_json to 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)
  • ShoppingRequest schema - defines the input parameters for google_search_shopping: q (query), gl, location, hl, page (inherited from BaseRequest), plus 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)",
        )
Behavior2/5

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

No annotations are present, so the description must fully cover behavioral traits. It states 'Search Google for results' which implies a read operation, but does not disclose any specifics about pagination, rate limits, or result structure.

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

Conciseness2/5

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

The description is a single short sentence, which is concise but at the expense of completeness and clarity. It sacrifices necessary detail for brevity.

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 tool's complexity (7 parameters, many siblings, no output schema), the description is woefully inadequate. It does not explain what the tool returns 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?

Schema description coverage is 100%, so the baseline is 3. The description adds no extra meaning beyond the schema; it does not reference or clarify any parameters.

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

Purpose1/5

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

The description simply says 'Search Google for results', which is extremely generic. It does not mention shopping, products, or commerce, failing to clarify the tool's specific purpose relative to its name and siblings.

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?

No guidance is provided on when to use this tool versus alternatives like google_search, google_search_shopping is not differentiated. The description offers no context about when to choose this tool.

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