Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

scrape_with_interaction

Extract web content after performing user interactions like clicks and scrolls to capture dynamically loaded data for development workflows.

Instructions

Scrape content after user interactions (click, scroll, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to scrape
interactionsYesList of interactions to perform

Implementation Reference

  • Tool registration in webScrapingTools array defining the 'scrape_with_interaction' tool, including name, description, and input schema for URL and interactions array.
    {
      name: 'scrape_with_interaction',
      description: 'Scrape content after user interactions (click, scroll, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL to scrape',
          },
          interactions: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                type: {
                  type: 'string',
                  enum: ['click', 'scroll', 'wait'],
                },
                selector: {
                  type: 'string',
                  description: 'CSS selector for click action',
                },
                timeout: {
                  type: 'number',
                  description: 'Timeout in milliseconds',
                },
              },
            },
            description: 'List of interactions to perform',
          },
        },
        required: ['url', 'interactions'],
      },
  • Handler dispatch in handleWebScrapingTool function that extracts interactions from params, calls DynamicScraper.scrapeWithInteraction, and formats the result.
    case 'scrape_with_interaction': {
      const interactions = params.interactions as Array<{
        type: 'click' | 'scroll' | 'wait';
        selector?: string;
        timeout?: number;
      }>;
      const data = await dynamicScraper.scrapeWithInteraction(config, interactions);
      return Formatters.formatScrapedData(data);
    }
  • Core handler implementation in DynamicScraper class: launches headless Chromium browser with Playwright, navigates to URL, executes sequence of interactions (click on selector, scroll to bottom, wait), then extracts page title, cleaned text, and full HTML.
    async scrapeWithInteraction(
      config: ScrapingConfig,
      interactions: Array<{ type: 'click' | 'scroll' | 'wait'; selector?: string; timeout?: number }>
    ): Promise<ScrapedData> {
      const browser = await this.getBrowser();
      const page = await browser.newPage();
    
      try {
        if (config.headers) {
          await page.setExtraHTTPHeaders(config.headers);
        }
    
        await page.goto(config.url, {
          waitUntil: 'networkidle',
          timeout: config.timeout || 30000,
        });
    
        // Perform interactions
        for (const interaction of interactions) {
          switch (interaction.type) {
            case 'click':
              if (interaction.selector) {
                await page.click(interaction.selector);
                await page.waitForTimeout(interaction.timeout || 1000);
              }
              break;
            case 'scroll':
              await page.evaluate(() => {
                if (typeof window !== 'undefined' && document.body) {
                  window.scrollTo(0, document.body.scrollHeight);
                }
              });
              await page.waitForTimeout(interaction.timeout || 1000);
              break;
            case 'wait':
              await page.waitForTimeout(interaction.timeout || 1000);
              break;
          }
        }
    
        // Extract content after interactions
        const title = await page.title();
        const text = await page.evaluate(() => {
          return document.body.innerText.replace(/\s+/g, ' ').trim();
        });
        const html = await page.content();
    
        return {
          url: config.url,
          title,
          text,
          html,
          scrapedAt: new Date(),
        };
      } finally {
        await page.close();
      }
    }
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 performing interactions like click and scroll, but doesn't describe what happens after interactions (e.g., does it return HTML, text, or something else?), potential side effects, error handling, or performance considerations. This is a significant gap for a tool that likely involves complex web interactions.

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 a single, efficient sentence that front-loads the core action ('Scrape content') and key constraint ('after user interactions'). There is zero waste, and it's appropriately sized for the tool's complexity.

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 a tool that performs web interactions and scraping, with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., scraped data format), error conditions, or behavioral nuances, leaving significant gaps for the agent to infer.

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 100%, so the schema already documents both parameters ('url' and 'interactions') thoroughly. The description adds no additional meaning beyond what's in the schema, such as explaining the purpose of interactions or providing examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 with a specific verb ('scrape') and resource ('content'), and it adds the key constraint 'after user interactions (click, scroll, etc.)'. However, it doesn't explicitly differentiate from sibling tools like 'scrape_dynamic_content' or 'extract_after_click', which appear related, so it misses full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or comparisons with sibling tools such as 'scrape_dynamic_content' or 'extract_after_click', leaving the agent with no usage context beyond the basic purpose.

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/code-alchemist01/development-tools-mcp-Server'

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