Skip to main content
Glama
webscraping-ai

WebScraping-AI MCP Server

Official

webscraping_ai_text

Extract clean text from web pages with JavaScript rendering, proxy support, and output in plain text, XML, or JSON formats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the target page.
text_formatNoFormat of the text response.json
return_linksNoReturn links from the page body text.
timeoutNoMaximum web page retrieval time in ms (20000 by default, maximum is 30000).
jsNoExecute on-page JavaScript using a headless browser (false by default).
js_timeoutNoMaximum JavaScript rendering time in ms (3000 by default).
wait_forNoCSS selector to wait for before returning the page content.
proxyNoType of proxy, datacenter or residential (datacenter by default).datacenter
countryNoCountry of the proxy to use (US by default).
custom_proxyNoYour own proxy URL in "http://user:password@host:port" format.
deviceNoType of device emulation.
error_on_404NoReturn error on 404 HTTP status on the target page (false by default).
error_on_redirectNoReturn error on redirect on the target page (false by default).
js_scriptNoCustom JavaScript code to execute on the target page.

Implementation Reference

  • The tool handler function for 'webscraping_ai_text'. It calls client.text() with the URL and options, then returns the response via createSanitizedResponse.
    server.tool(
      'webscraping_ai_text',
      {
        url: z.string().describe('URL of the target page.'),
        text_format: z.enum(['plain', 'xml', 'json']).optional().default('json').describe('Format of the text response.'),
        return_links: z.boolean().optional().describe('Return links from the page body text.'),
        ...commonOptionsSchema
      },
      async ({ url, text_format, return_links, ...options }) => {
        try {
          const result = await client.text(url, {
            ...options,
            text_format,
            return_links
          });
    
          const content = typeof result === 'object' ? JSON.stringify(result) : result;
    
          return createSanitizedResponse(content, url);
        } catch (error) {
          const errorObj = JSON.parse(error.message);
          return createSanitizedResponse(JSON.stringify(errorObj), url, true);
        }
      }
    );
  • Input schema for the 'webscraping_ai_text' tool, defining url, text_format, return_links, and common options.
    {
      url: z.string().describe('URL of the target page.'),
      text_format: z.enum(['plain', 'xml', 'json']).optional().default('json').describe('Format of the text response.'),
      return_links: z.boolean().optional().describe('Return links from the page body text.'),
      ...commonOptionsSchema
    },
  • src/index.js:285-309 (registration)
    Registration of the 'webscraping_ai_text' tool using server.tool() with the MCP SDK.
    server.tool(
      'webscraping_ai_text',
      {
        url: z.string().describe('URL of the target page.'),
        text_format: z.enum(['plain', 'xml', 'json']).optional().default('json').describe('Format of the text response.'),
        return_links: z.boolean().optional().describe('Return links from the page body text.'),
        ...commonOptionsSchema
      },
      async ({ url, text_format, return_links, ...options }) => {
        try {
          const result = await client.text(url, {
            ...options,
            text_format,
            return_links
          });
    
          const content = typeof result === 'object' ? JSON.stringify(result) : result;
    
          return createSanitizedResponse(content, url);
        } catch (error) {
          const errorObj = JSON.parse(error.message);
          return createSanitizedResponse(JSON.stringify(errorObj), url, true);
        }
      }
    );
  • The client.text() helper method that makes the actual HTTP request to the /text endpoint of the WebScraping.AI API.
    async text(url, options = {}) {
      return this.request('/text', {
        url,
        ...options
      });
  • The createSanitizedResponse helper used by the handler to format and optionally sandbox the response content.
    function createSanitizedResponse(content, url, isError = false) {
      if (isError) {
        return {
          content: [{ type: 'text', text: content }],
          isError: true
        };
      }
    
      // Process the content (apply sandboxing if enabled)
      const result = sanitizer.sanitize(content, { url });
    
      // Create response
      return {
        content: [{ type: 'text', text: result.content }]
      };
    }
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/webscraping-ai/webscraping-ai-mcp-server'

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