Skip to main content
Glama
garylab

Serper MCP Server

by garylab

google_search_lens

Search Google by submitting a URL to retrieve relevant results. Specify country and language to refine the search scope.

Instructions

Search Google for results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe url to search
glNoThe country to search in, e.g. us, uk, ca, au, etc.
hlNoThe language to search in, e.g. en, es, fr, de, etc.

Implementation Reference

  • The handler function that executes google_search_lens logic. It derives the API endpoint by taking the last segment of the tool name (e.g., 'lens' from 'google_search_lens') and makes a POST request to the Serper.dev 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)
  • The LensRequest input schema for the google_search_lens tool. It accepts a 'url' (required), and optional 'gl' (country) and 'hl' (language) fields.
    class LensRequest(BaseModel):
        url: str = Field(..., description="The url to search")
        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."
        )
  • Maps the SerperTools.GOOGLE_SEARCH_LENS enum value to the LensRequest schema in the google_request_map, which is used for tool registration and execution routing.
    SerperTools.GOOGLE_SEARCH_LENS: LensRequest,
  • The list_tools() function that registers the tool with MCP by iterating the request map and creating Tool objects with the name (google_search_lens) and input schema.
    @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
  • The enum definition GOOGLE_SEARCH_LENS = 'google_search_lens', which is the canonical string identifier for the tool.
    GOOGLE_SEARCH_LENS = "google_search_lens"
Behavior2/5

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

With no annotations, the description should disclose key behavioral traits. It fails to explain what 'results' means (likely image recognition results) and does not indicate whether it performs a visual search or a standard web search.

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

Conciseness3/5

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

The description is concise (one sentence) but overly vague. Conciseness should not sacrifice clarity; here it does.

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

Completeness2/5

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

Given 3 parameters, no output schema, and no annotations, the description is insufficient for an agent to correctly decide when to use this tool. The presence of many sibling tools increases the need for specificity, which is lacking.

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 coverage is 100%, so the baseline is 3. The description adds no extra meaning beyond the schema, but the schema itself adequately describes the parameters (url, gl, hl).

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 vague and does not specify that this tool is for Google Lens (visual search) as opposed to general web search. Given sibling tools like 'google_search' and 'google_search_images', the purpose is unclear.

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

Usage Guidelines2/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. The description does not mention image-based search or any specific use case.

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