Skip to main content
Glama

web_data_bestbuy_products

Extract structured product data from BestBuy URLs using reliable cache lookups instead of web scraping.

Instructions

Quickly read structured bestbuy product data. Requires a valid bestbuy product URL. This can be a cache lookup, so it can be more reliable than scraping

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • Core handler logic for the 'web_data_bestbuy_products' tool (shared with other dataset tools). Triggers the BrightData Datasets API v3 collection using the specific dataset_id 'gd_ltre1jqe1jfr7cccf', polls the snapshot status up to 600 seconds, and returns the collected data as a JSON string.
    execute: tool_fn(`web_data_${id}`, async(data, ctx)=>{
        let trigger_response = await axios({
            url: 'https://api.brightdata.com/datasets/v3/trigger',
            params: {dataset_id, include_errors: true},
            method: 'POST',
            data: [data],
            headers: api_headers(),
        });
        if (!trigger_response.data?.snapshot_id)
            throw new Error('No snapshot ID returned from request');
        let snapshot_id = trigger_response.data.snapshot_id;
        console.error(`[web_data_${id}] triggered collection with `
            +`snapshot ID: ${snapshot_id}`);
        let max_attempts = 600;
        let attempts = 0;
        while (attempts < max_attempts)
        {
            try {
                if (ctx && ctx.reportProgress)
                {
                    await ctx.reportProgress({
                        progress: attempts,
                        total: max_attempts,
                        message: `Polling for data (attempt `
                            +`${attempts + 1}/${max_attempts})`,
                    });
                }
                let snapshot_response = await axios({
                    url: `https://api.brightdata.com/datasets/v3`
                        +`/snapshot/${snapshot_id}`,
                    params: {format: 'json'},
                    method: 'GET',
                    headers: api_headers(),
                });
                if (['running', 'building'].includes(snapshot_response.data?.status))
                {
                    console.error(`[web_data_${id}] snapshot not ready, `
                        +`polling again (attempt `
                        +`${attempts + 1}/${max_attempts})`);
                    attempts++;
                    await new Promise(resolve=>setTimeout(resolve, 1000));
                    continue;
                }
                console.error(`[web_data_${id}] snapshot data received `
                    +`after ${attempts + 1} attempts`);
                let result_data = JSON.stringify(snapshot_response.data);
                return result_data;
            } catch(e){
                console.error(`[web_data_${id}] polling error: `
                    +`${e.message}`);
                attempts++;
                await new Promise(resolve=>setTimeout(resolve, 1000));
            }
        }
        throw new Error(`Timeout after ${max_attempts} seconds waiting `
            +`for data`);
    }),
  • server.js:674-745 (registration)
    Registration loop that dynamically creates and registers the 'web_data_bestbuy_products' tool (when processing the 'bestbuy_products' dataset entry), including name construction, schema from inputs, description, and handler.
    for (let {dataset_id, id, description, inputs, defaults = {}} of datasets)
    {
        let parameters = {};
        for (let input of inputs)
        {
            let param_schema = input=='url' ? z.string().url() : z.string();
            parameters[input] = defaults[input] !== undefined ?
                param_schema.default(defaults[input]) : param_schema;
        }
        addTool({
            name: `web_data_${id}`,
            description,
            parameters: z.object(parameters),
            execute: tool_fn(`web_data_${id}`, async(data, ctx)=>{
                let trigger_response = await axios({
                    url: 'https://api.brightdata.com/datasets/v3/trigger',
                    params: {dataset_id, include_errors: true},
                    method: 'POST',
                    data: [data],
                    headers: api_headers(),
                });
                if (!trigger_response.data?.snapshot_id)
                    throw new Error('No snapshot ID returned from request');
                let snapshot_id = trigger_response.data.snapshot_id;
                console.error(`[web_data_${id}] triggered collection with `
                    +`snapshot ID: ${snapshot_id}`);
                let max_attempts = 600;
                let attempts = 0;
                while (attempts < max_attempts)
                {
                    try {
                        if (ctx && ctx.reportProgress)
                        {
                            await ctx.reportProgress({
                                progress: attempts,
                                total: max_attempts,
                                message: `Polling for data (attempt `
                                    +`${attempts + 1}/${max_attempts})`,
                            });
                        }
                        let snapshot_response = await axios({
                            url: `https://api.brightdata.com/datasets/v3`
                                +`/snapshot/${snapshot_id}`,
                            params: {format: 'json'},
                            method: 'GET',
                            headers: api_headers(),
                        });
                        if (['running', 'building'].includes(snapshot_response.data?.status))
                        {
                            console.error(`[web_data_${id}] snapshot not ready, `
                                +`polling again (attempt `
                                +`${attempts + 1}/${max_attempts})`);
                            attempts++;
                            await new Promise(resolve=>setTimeout(resolve, 1000));
                            continue;
                        }
                        console.error(`[web_data_${id}] snapshot data received `
                            +`after ${attempts + 1} attempts`);
                        let result_data = JSON.stringify(snapshot_response.data);
                        return result_data;
                    } catch(e){
                        console.error(`[web_data_${id}] polling error: `
                            +`${e.message}`);
                        attempts++;
                        await new Promise(resolve=>setTimeout(resolve, 1000));
                    }
                }
                throw new Error(`Timeout after ${max_attempts} seconds waiting `
                    +`for data`);
            }),
        });
    }
  • Schema definition for the tool: input parameter 'url' (validated as URL string), description, and links to dataset_id 'gd_ltre1jqe1jfr7cccf' used in handler.
        id: 'bestbuy_products',
        dataset_id: 'gd_ltre1jqe1jfr7cccf',
        description: [
            'Quickly read structured bestbuy product data.',
            'Requires a valid bestbuy product URL.',
            'This can be a cache lookup, so it can be more reliable than scraping',
        ].join('\n'),
        inputs: ['url'],
    }, {
Behavior3/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. It mentions the tool is a 'cache lookup' and 'more reliable than scraping,' which adds useful context about performance and reliability. However, it doesn't disclose other important behavioral traits like error handling, rate limits, authentication needs, or what 'structured data' specifically includes. The description doesn't contradict any annotations since none exist.

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 and well-structured across three sentences. Each sentence adds distinct value: the first states the core purpose, the second specifies the required parameter, and the third provides comparative reliability context. There is zero wasted verbiage, and information is front-loaded appropriately.

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

Completeness3/5

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

Given the tool's moderate complexity (data retrieval from a specific e-commerce site), no annotations, no output schema, and minimal parameter documentation, the description is adequate but incomplete. It covers the basic purpose, parameter requirement, and reliability advantage, but lacks details on output format, error conditions, or behavioral constraints that would help an agent 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 input schema has 1 parameter with 0% description coverage, so the schema provides no semantic information. The description adds value by specifying that the 'url' parameter must be 'a valid bestbuy product URL,' which clarifies the expected format and domain. However, it doesn't provide further details like URL validation rules, examples, or constraints beyond 'valid.'

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: 'Quickly read structured bestbuy product data.' It specifies the verb ('read'), resource ('bestbuy product data'), and key attributes ('structured', 'quickly'). However, it doesn't explicitly differentiate from sibling tools like 'web_data_amazon_product' or 'web_data_walmart_product' beyond mentioning Best Buy specifically.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: 'Requires a valid bestbuy product URL.' It also offers comparative guidance: 'This can be a cache lookup, so it can be more reliable than scraping,' which implicitly positions it against scraping tools like 'scrape_as_html' or 'scrape_as_markdown.' However, it doesn't explicitly state when NOT to use it or name specific alternative tools.

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