Skip to main content
Glama
cortex8

DataForSEO MCP Server

by cortex8

on_page_content_parsing

Parse webpage content to extract structured data including links, headings, and text for SEO analysis and content processing.

Instructions

This endpoint allows parsing the content on any page you specify and will return the structured content of the target page, including link URLs, anchors, headings, and textual content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accept_languageNoAccept-Language header value
custom_jsNoCustom JavaScript code to execute
custom_user_agentNoCustom User-Agent header
enable_javascriptNoEnable JavaScript rendering
urlYesURL of the page to parse

Implementation Reference

  • The handle() method executes the tool logic: sends POST request to DataForSEO /v3/on_page/content_parsing/live, processes response based on config, and returns formatted markdown content or full response.
    async handle(params: { 
      url: string; 
      enable_javascript?: boolean; 
      custom_js?: string; 
      custom_user_agent?: string; 
      accept_language?: string; 
    }): Promise<any> {
      try {
        const response = await this.dataForSEOClient.makeRequest('/v3/on_page/content_parsing/live', 'POST', [{
          url: params.url,
          enable_javascript: params.enable_javascript,
          custom_js: params.custom_js,
          custom_user_agent: params.custom_user_agent,
          accept_language: params.accept_language,
          markdown_view: true
        }]);
        console.error(JSON.stringify(response));
        if(defaultGlobalToolConfig.fullResponse || this.supportOnlyFullResponse()){
          let data = response as DataForSEOFullResponse;
          this.validateResponseFull(data);
          let result = data.tasks[0].result;
          return this.formatResponse(result);
        }
        else{
          let data = response as DataForSEOResponse;
          this.validateResponse(data);
          let result = data.items[0].page_as_markdown;
          return this.formatResponse(result);
        }
      } catch (error) {
        return this.formatErrorResponse(error);
      }
    }
  • Defines the input schema using Zod for parameters: url (required), and optional flags for JS, custom JS, UA, language.
    getParams(): z.ZodRawShape {
      return {
        url: z.string().describe("URL of the page to parse"),
        enable_javascript: z.boolean().optional().describe("Enable JavaScript rendering"),
        custom_js: z.string().optional().describe("Custom JavaScript code to execute"),
        custom_user_agent: z.string().optional().describe("Custom User-Agent header"),
        accept_language: z.string().optional().describe("Accept-Language header value"),
      };
    }
  • Registers the ContentParsingTool (among others) in the OnPageApiModule's getTools() by instantiating it and mapping to a ToolDefinition object using getName() 'on_page_content_parsing' as key, exposing description, params, and wrapped handler.
    getTools(): Record<string, ToolDefinition> {
      const tools = [
        new ContentParsingTool(this.dataForSEOClient),
        new InstantPagesTool(this.dataForSEOClient),
        new LighthouseTool(this.dataForSEOClient),
        // Add more tools here
      ];
    
      return tools.reduce((acc, tool) => ({
        ...acc,
        [tool.getName()]: {
          description: tool.getDescription(),
          params: tool.getParams(),
          handler: (params: any) => tool.handle(params),
        },
      }), {});
    }
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 states the tool returns structured content, but doesn't cover critical aspects like rate limits, authentication needs, error handling, or performance implications (e.g., timeouts for JavaScript-heavy pages). The mention of 'parsing' implies a read-only operation, but this isn't explicitly confirmed, leaving gaps in transparency.

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 a single, efficient sentence that front-loads the core functionality. It avoids unnecessary words and directly states what the tool does. However, it could be slightly more structured by separating the action from the output details for clarity.

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 tool has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the return format (e.g., structure of parsed content), error cases, or dependencies like network access. For a parsing tool with multiple configuration options, this leaves significant gaps for an AI agent to 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?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., it doesn't explain how 'custom_js' interacts with 'enable_javascript'). This meets the baseline for high schema coverage, but no extra value is provided.

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: parsing page content and returning structured data including links, anchors, headings, and text. It specifies the verb ('parsing') and resource ('content on any page'), making the function understandable. However, it doesn't explicitly differentiate from sibling tools like 'on_page_instant_pages' or 'on_page_lighthouse', which might have overlapping or related functionality.

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 mentions parsing 'any page' but doesn't specify contexts, prerequisites, or exclusions. Given the sibling tools include other on_page tools, this lack of differentiation leaves the agent without clear usage instructions.

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/cortex8/oyt-dataforseo-mcp-worker'

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