Skip to main content
Glama

search_engine

Extract search engine results from Google, Bing, or Yandex to obtain URLs, titles, and descriptions for web research and data collection.

Instructions

Scrape search results from Google, Bing or Yandex. Returns SERP results in markdown (URL, title, description)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
engineNogoogle
cursorNoPagination cursor for next page

Implementation Reference

  • Handler for the 'search_engine' tool. Constructs a search URL using the search_url helper, sends a POST request to BrightData API's /request endpoint using the unlocker zone, requests markdown format, and returns the scraped SERP results.
    execute: tool_fn('search_engine', async({query, engine, cursor})=>{
        let response = await axios({
            url: 'https://api.brightdata.com/request',
            method: 'POST',
            data: {
                url: search_url(engine, query, cursor),
                zone: unlocker_zone,
                format: 'raw',
                data_format: 'markdown',
            },
            headers: api_headers(),
            responseType: 'text',
        });
    
        return response.data;
    }),
  • Zod schema defining the input parameters for the 'search_engine' tool: 'query' (required string), 'engine' (optional enum ['google', 'bing', 'yandex'], defaults to 'google'), 'cursor' (optional string for pagination).
    parameters: z.object({
        query: z.string(),
        engine: z.enum([
            'google',
            'bing',
            'yandex',
        ]).optional().default('google'),
        cursor: z.string().optional().describe('Pagination cursor for next page'),
    }),
  • server.js:130-159 (registration)
    Registers the 'search_engine' tool with the FastMCP server using addTool, specifying name, description, input schema, and execute handler.
    addTool({
        name: 'search_engine',
        description: 'Scrape search results from Google, Bing or Yandex. Returns '
        +'SERP results in markdown (URL, title, description)',
        parameters: z.object({
            query: z.string(),
            engine: z.enum([
                'google',
                'bing',
                'yandex',
            ]).optional().default('google'),
            cursor: z.string().optional().describe('Pagination cursor for next page'),
        }),
        execute: tool_fn('search_engine', async({query, engine, cursor})=>{
            let response = await axios({
                url: 'https://api.brightdata.com/request',
                method: 'POST',
                data: {
                    url: search_url(engine, query, cursor),
                    zone: unlocker_zone,
                    format: 'raw',
                    data_format: 'markdown',
                },
                headers: api_headers(),
                responseType: 'text',
            });
    
            return response.data;
        }),
    });
  • Helper function that constructs the search engine URL (Google, Bing, or Yandex) based on the query, engine, and cursor (for pagination), properly encoding the query and calculating start/page parameters.
    function search_url(engine, query, cursor){
        let q = encodeURIComponent(query);
        let page = cursor ? parseInt(cursor) : 0;
        let start = page * 10;
        if (engine=='yandex')
            return `https://yandex.com/search/?text=${q}&p=${page}`;
        if (engine=='bing')
            return `https://www.bing.com/search?q=${q}&first=${start + 1}`;
        return `https://www.google.com/search?q=${q}&start=${start}`;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions scraping and return format (SERP results in markdown), but lacks critical behavioral details: whether this requires authentication, rate limits, potential blocking risks, pagination behavior beyond the cursor parameter, or error handling. For a scraping tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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?

Perfectly concise and front-loaded: two sentences that directly state what the tool does and what it returns. Every word earns its place with zero redundancy or unnecessary elaboration.

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 the complexity of web scraping (which involves network calls, potential failures, and structured data extraction), no annotations, and no output schema, the description is incomplete. It doesn't cover error conditions, rate limits, authentication needs, or detailed output structure beyond 'markdown'. For a tool with 3 parameters and significant behavioral implications, more context is needed.

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 33% (only cursor has a description). The description adds minimal parameter context: it implies 'engine' selects between Google/Bing/Yandex (though the enum already shows this) and 'query' is for search terms. However, it doesn't explain parameter interactions, format requirements for query, or how cursor works with the returned results. With low schema coverage, the description provides some but insufficient compensation.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Scrape search results from Google, Bing or Yandex' specifies the verb (scrape) and resource (search results from specific engines). It distinguishes from many siblings that scrape specific websites (e.g., web_data_amazon_product) but doesn't explicitly differentiate from generic scraping tools like scrape_as_html or scrape_as_markdown.

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 on when to use this tool versus alternatives. It doesn't mention when to choose search_engine over other scraping tools like scrape_as_html for the same search engines, or when to use it versus specialized web_data tools for specific platforms. The description provides no context about use cases or exclusions.

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/dsouza-anush/brightdata-mcp-heroku'

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