Skip to main content
Glama
PedroDnT

MCP Deep Web Research Server

visit_page

Extract content from webpages to enable advanced web research with intelligent search queuing and enhanced content analysis capabilities.

Instructions

Visit a webpage and extract its content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to visit

Implementation Reference

  • Main handler logic for the 'visit_page' tool. Validates input URL, launches browser if needed, navigates safely, extracts page title and markdown content, returns structured JSON.
    case 'visit_page': {
        const args = request.params.arguments as unknown as VisitPageArgs;
        if (!args?.url) {
            throw new McpError(ErrorCode.InvalidParams, 'URL is required');
        }
    
        if (!isValidUrl(args.url)) {
            throw new McpError(
                ErrorCode.InvalidParams,
                `Invalid URL: ${args.url}. Only http and https protocols are supported.`
            );
        }
    
        const page = await ensureBrowser();
        try {
            await safePageNavigation(page, args.url);
            const title = await page.title();
            const content = await extractContentAsMarkdown(page);
    
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            url: args.url,
                            title,
                            content
                        }, null, 2)
                    }
                ]
            };
        } catch (error) {
            throw new McpError(
                ErrorCode.InternalError,
                `Failed to visit page: ${(error as Error).message}`
            );
        }
    }
  • src/index.ts:148-161 (registration)
    Registration of the 'visit_page' tool in the listTools handler, including name, description, and input schema.
    {
        name: 'visit_page',
        description: 'Visit a webpage and extract its content',
        inputSchema: {
            type: 'object',
            properties: {
                url: {
                    type: 'string',
                    description: 'URL to visit'
                }
            },
            required: ['url']
        }
    }
  • TypeScript interface defining the input arguments for the visit_page tool.
    interface VisitPageArgs {
        url: string;
    }
  • Helper function to extract main content from the page and convert it to clean Markdown using TurndownService.
    async function extractContentAsMarkdown(page: Page): Promise<string> {
        const html = await page.evaluate(() => {
            // Try standard content containers first
            const contentSelectors = [
                'main',
                'article',
                '[role="main"]',
                '#content',
                '.content',
                '.main',
                '.post',
                '.article'
            ];
    
            for (const selector of contentSelectors) {
                const element = document.querySelector(selector);
                if (element) {
                    return element.outerHTML;
                }
            }
    
            // Fallback to cleaning full body content
            const body = document.body;
            const elementsToRemove = [
                'header', 'footer', 'nav',
                '[role="navigation"]', 'aside',
                '.sidebar', '[role="complementary"]',
                '.nav', '.menu', '.header',
                '.footer', '.advertisement',
                '.ads', '.cookie-notice'
            ];
    
            elementsToRemove.forEach(sel => {
                body.querySelectorAll(sel).forEach(el => el.remove());
            });
    
            return body.outerHTML;
        });
    
        if (!html) {
            return '';
        }
    
        try {
            const markdown = turndownService.turndown(html);
            return markdown
                .replace(/\n{3,}/g, '\n\n')
                .replace(/^- $/gm, '')
                .replace(/^\s+$/gm, '')
                .trim();
        } catch (error) {
            console.error('Error converting HTML to Markdown:', error);
            return html;
        }
    }
  • Helper for safe navigation: goes to URL, detects and throws on bot protection or suspicious challenges.
    async function safePageNavigation(page: Page, url: string): Promise<void> {
        await page.goto(url, {
            waitUntil: 'domcontentloaded',
            timeout: 10000 // 10 second timeout
        });
    
        // Quick check for bot protection or security challenges
        const validation = await page.evaluate(() => {
            const botProtectionExists = [
                '#challenge-running',
                '#cf-challenge-running',
                '#px-captcha',
                '#ddos-protection',
                '#waf-challenge-html'
            ].some(selector => document.querySelector(selector));
    
            const suspiciousTitle = [
                'security check',
                'ddos protection',
                'please wait',
                'just a moment',
                'attention required'
            ].some(phrase => document.title.toLowerCase().includes(phrase));
    
            return {
                botProtection: botProtectionExists,
                suspiciousTitle,
                title: document.title
            };
        });
    
        if (validation.botProtection) {
            throw new Error('Bot protection detected');
        }
    
        if (validation.suspiciousTitle) {
            throw new Error(`Suspicious page title detected: "${validation.title}"`);
        }
    }
Behavior2/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. While 'visit' and 'extract' imply read-only operations, it doesn't specify important behavioral traits like rate limits, authentication needs, timeout behavior, content format returned, error handling, or whether it follows redirects. The description is minimal and lacks operational context.

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 with just 7 words that directly state the tool's function. Every word earns its place, and the information is front-loaded with no unnecessary elaboration or redundancy.

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?

For a tool with no annotations, no output schema, and sibling tools that likely serve related purposes, the description is insufficient. It doesn't explain what 'extract its content' means in practice, what format the content returns in, how it handles different content types, or how it differs from the research/search siblings.

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 100% description coverage with a clear parameter description for 'url'. The tool description doesn't add any parameter-specific information beyond what the schema already provides, so it meets the baseline score of 3 for high schema coverage.

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 ('visit') and resource ('webpage'), and specifies the action ('extract its content'). It distinguishes itself from potential siblings by focusing on single-page content extraction rather than research or parallel operations, though it doesn't explicitly name alternatives.

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 the sibling tools 'deep_research' or 'parallel_search'. It doesn't mention any prerequisites, limitations, or contextual factors that would help an agent choose between these options.

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/PedroDnT/mcp-DEEPwebresearch'

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