browser_get_page_source
Retrieve the complete HTML source code of the current web page for analysis, testing, or data extraction purposes during browser automation.
Instructions
Get the current page source
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/browserTools.ts:145-162 (registration)Registers the 'browser_get_page_source' tool with an empty input schema and an inline handler that fetches the current page source using the WebDriver instance from StateManager and returns it in the response content.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}`, }, ], }; } });
- src/tools/index.ts:9-9 (registration)Calls registerBrowserTools which includes the registration of browser_get_page_source among other browser tools.registerBrowserTools(server, stateManager);