Added stagehand_get_html tool to Stagehand MCP Server#81
Added stagehand_get_html tool to Stagehand MCP Server#81travisrussi wants to merge 1 commit intobrowserbase:mainfrom
Conversation
|
Hey @travisrussi, what exactly would you need the stagehand_get_html tool for? do you have use cases already in mind? |
|
@Kylejeong2, I was building a web scraper and I wanted to find and test the CSS and XPath selectors. That required having the page HTML stored locally. My approach was using Stagehand to initially identify the specific elements on the page to build the scraper. When running the scraper, I would use traditional selectors as the primary location method, with Stagehand LLM location as the secondary method (because there's a cost associated with that method). |
Hey @travisrussi, we're going to do a major refactor soon. If you want to have that method in your local version of MCP feel free; we're open source. But for the official version I don't think we're planning on adding this to the tools. |
|
Yeah in my experience tools like LLMs tend to reach for those calls too quickly, then end up blowing up their context / going down brittle rabbitholes, losing sight of the high-level goal. |
Added ability to get the HTML of the current page with a
stagehand_get_htmlMCP tool.Since the HTML is usually too big to send via the messaging protocol, the HTML file is saved locally to a
tmpfolder and a simple HTTP Server is spun up to serve the file (usually via CURL from the client). The port defaults to 8080, but can be configured via theSTAGEHAND_HTTP_PORTenvironment variable.