Skip to main content
Glama
garylab
by garylab

google_search_shopping

Retrieve shopping results from Google by entering a query, specifying location, language, and page number. Optimize searches with autocomplete and result count adjustments for tailored product discovery.

Instructions

Search Google for results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
autocorrectNoAutomatically correct
glNoThe country to search in, e.g. us, uk, ca, au, etc.
hlNoThe language to search in, e.g. en, es, fr, de, etc.
locationNoThe location to search in, e.g. San Francisco, CA, USA
numNoThe number of results to return, max is 100
pageNoThe page number to return, first page is 1
qYesThe query to search for

Implementation Reference

  • Executes the tool logic by deriving the API endpoint ('/shopping' for google_search_shopping) from the tool name and calling 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)
  • Pydantic input schema specific to the google_search_shopping tool, extending BaseRequest with 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)", )
  • Mapping of tool enums to their respective request schemas, used for both tool registration and call dispatch; includes google_search_shopping -> ShoppingRequest.
    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, }
  • Registers all Google search tools, including google_search_shopping, with MCP by providing name and inputSchema from the mapped request models.
    @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
  • Enum value defining the exact tool name string 'google_search_shopping'.
    GOOGLE_SEARCH_SHOPPING = "google_search_shopping"

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