browser_get_visible_html
Extract the visible HTML content of a webpage using Chrome automation, bypassing anti-bot detection for reliable web scraping and testing.
Instructions
Get the HTML of the current page
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "browser_get_visible_html"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The primary handler and registration for the 'browser_get_visible_html' tool. Decorated with @mcp.tool() to register it in the MCP server. Ensures browser is initialized, retrieves the current page's HTML source using driver.page_source, and returns it wrapped in a success response.
@mcp.tool() async def browser_get_visible_html(): """Get the HTML of the current page""" async def get_visible_html_handler(driver: uc.Chrome): return await create_success_response(driver.page_source) return await tool.safe_execute( ToolContext(webdriver=await ensure_browser()), get_visible_html_handler )