Skip to main content
Glama
ztobs

Browser Use Server

by ztobs

get_html

Retrieve HTML content from webpages for browser automation tasks, enabling data extraction and page analysis through URL navigation and post-load actions.

Instructions

Get the HTML content of a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to navigate to
stepsNoComma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")

Implementation Reference

  • Core handler logic for 'get_html' command: validates URL, uses an AI agent to navigate and perform optional steps, then retrieves and returns the page HTML.
    elif command == 'get_html':
        if not args.get('url'):
            return {
                'success': False,
                'error': 'URL is required for get_html command'
            }
            
        task = f"1. Go to {args['url']}"
        if args.get('steps'):
            steps = args['steps'].split(',')
            for i, step in enumerate(steps, 2):
                task += f"\n{i}. {step.strip()}"
            task += f"\n{len(steps) + 2}. Get the page HTML"
        else:
            task += "\n2. Get the page HTML"
        use_vision = os.getenv('USE_VISION', 'false').lower() == 'true'
        agent = Agent(task=task, llm=llm, use_vision=use_vision, browser_context=context)
        await agent.run()
        
        try:
            html = await context.get_page_html()
            return {
                'success': True,
                'html': html
            }
        finally:
            await context.close()
  • Input schema definition for the 'get_html' tool, specifying required 'url' and optional 'steps' parameters.
    name: 'get_html',
    description: 'Get the HTML content of a webpage',
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'The URL to navigate to',
        },
        steps: {
          type: 'string',
          description: 'Comma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")',
        },
      },
      required: ['url'],
    },
  • MCP server handler that processes the 'get_html' tool call response from Python backend and formats it as MCP content.
    } else if (request.params.name === 'get_html') {
      return {
        content: [
          {
            type: 'text',
            text: result.html,
          },
        ],
      };
  • src/index.ts:141-233 (registration)
    Registers the 'get_html' tool with the MCP server using addTool, including its schema.
            const stdout = Buffer.concat(stdoutChunks).toString('utf8');
            reject(new Error(`Failed to parse Python script output: ${error}\nOutput was: ${stdout}`));
          }
        });
      });
    }
    
    private setupToolHandlers() {
      this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
          {
            name: 'screenshot',
            description: 'Take a screenshot of a webpage',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
                full_page: {
                  type: 'boolean',
                  description: 'Whether to capture the full page or just the viewport',
                  default: false,
                },
                steps: {
                  type: 'string',
                  description: 'Comma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")',
                },
              },
              required: ['url'],
            },
          },
          {
            name: 'get_html',
            description: 'Get the HTML content of a webpage',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
                steps: {
                  type: 'string',
                  description: 'Comma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")',
                },
              },
              required: ['url'],
            },
          },
          {
            name: 'execute_js',
            description: 'Execute JavaScript code on a webpage',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
                script: {
                  type: 'string',
                  description: 'The JavaScript code to execute',
                },
                steps: {
                  type: 'string',
                  description: 'Comma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")',
                },
              },
              required: ['url', 'script'],
            },
          },
          {
            name: 'get_console_logs',
            description: 'Get the console logs of a webpage',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
                steps: {
                  type: 'string',
                  description: 'Comma-separated actions or sentences describing steps to take after page load (e.g., "click #submit, scroll down" or "Fill the login form and submit")',
                },
              },
              required: ['url'],
            },
          },
        ],
      }));
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. It states what the tool does but doesn't describe how it behaves—e.g., whether it follows redirects, handles authentication, respects rate limits, or returns errors. This leaves critical operational details unspecified.

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, clear sentence with zero wasted words. It's front-loaded and efficiently communicates the core function without unnecessary elaboration, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete for a tool with two parameters and potential behavioral complexity. It doesn't address what the tool returns (e.g., raw HTML, status codes), error handling, or dependencies, leaving significant gaps for an AI 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 'steps') thoroughly. The description doesn't add any meaning beyond what the schema provides, such as clarifying the interaction between parameters or providing examples of 'steps' usage, resulting in a baseline score.

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 action ('Get') and resource ('HTML content of a webpage'), making the purpose immediately understandable. It doesn't specifically differentiate from sibling tools like 'execute_js' or 'screenshot', but the core function is unambiguous.

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 like 'execute_js' or 'screenshot'. It doesn't mention prerequisites, limitations, or scenarios where this tool is preferred over others, leaving usage context entirely implicit.

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/ztobs/cline-browser-use-mcp'

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