Skip to main content
Glama

browser_get_page_source

Retrieve the complete HTML source code of the current web page for analysis, debugging, or content extraction during browser automation.

Instructions

Get the current page source

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler function for the browser_get_page_source tool. It gets the current WebDriver instance from the StateManager, calls getPageSource() to retrieve the HTML source of the current page, and returns it formatted in the MCP response. Error handling returns an error message.
    server.tool('browser_get_page_source', 'Get the current page source', {}, async () => { try { const driver = stateManager.getDriver(); const pageSource = await driver.getPageSource(); return { content: [{ type: 'text', text: `Current page source is: ${pageSource}` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error getting page source: ${(e as Error).message}`, }, ], }; } });

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/pshivapr/selenium-mcp'

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