Skip to main content
Glama

scraping_browser_links

Extract all links, text, and selectors from web pages to validate click targets and gather structured data for web scraping and browser automation.

Instructions

Get all links on the current page, text and selectors It's strongly recommended that you call the links tool to check that your click target is valid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that executes the tool logic: retrieves all anchor ('a') elements on the current page, extracts their text, href, and outerHTML as selector, and returns them as JSON.
    execute: async()=>{
        const page = await (await require_browser()).get_page();
        try {
            const links = await page.$$eval('a', elements=>{
                return elements.map(el=>{
                    return {
                        text: el.innerText,
                        href: el.href,
                        selector: el.outerHTML,
                    };
                });
            });
            return JSON.stringify(links, null, 2);
        } catch(e){
            throw new UserError(`Error getting links: ${e}`);
        }
    },
  • Zod input schema defining no parameters are required for this tool.
    parameters: z.object({}),
    execute: async()=>{
  • The tool object 'scraping_browser_links' is registered by being included in the exported 'tools' array (line 311 specifically), conditional on API_TOKEN being set.
    export const tools = process.env.API_TOKEN ? [
        scraping_browser_navigate,
        scraping_browser_go_back,
        scraping_browser_go_forward,
        scraping_browser_links,
        scraping_browser_click,
        scraping_browser_type,
        scraping_browser_wait_for,
        scraping_browser_screenshot,
        scraping_browser_get_text,
        scraping_browser_get_html,
        scraping_browser_scroll,
        scraping_browser_scroll_to,
    ] : [scraping_browser_activation_instructions];
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions a recommendation for validation but lacks details on critical behaviors: it doesn't specify if this is a read-only operation, what the output format is (e.g., list of objects with text and selectors), potential errors, or performance implications. The description adds minimal context beyond the basic action, leaving gaps for an AI agent.

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

Conciseness4/5

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

The description is concise and front-loaded, with the core purpose stated first in one sentence and a usage tip in the second. Both sentences earn their place by providing essential information without waste. It could be slightly improved by integrating the guidance more seamlessly, but it's efficient overall.

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 complexity (a scraping operation with no parameters but potential behavioral nuances), the description is minimally adequate. It lacks an output schema, so the description doesn't explain return values, and with no annotations, it misses behavioral details. It covers the basic purpose and a usage tip but leaves out specifics on output format or error handling, making it incomplete for optimal agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate. A baseline of 4 is applied since it doesn't need to compensate for any schema gaps, and it avoids redundancy.

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: 'Get all links on the current page, text and selectors.' It specifies the verb ('Get'), resource ('links'), and scope ('on the current page'), making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'scraping_browser_get_html' or 'scraping_browser_get_text', which could also retrieve page content, so it falls short of a perfect score.

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 usage guidance by recommending to 'call the links tool to check that your click target is valid,' implying this tool is for link discovery before interactions like clicking. It suggests a workflow but doesn't explicitly state when not to use it or name alternatives among siblings, such as 'scraping_browser_click' for direct actions, so it's not fully comprehensive.

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