browser_get_page_info
Extract comprehensive page data including HTML content, statistics, and metadata from browser instances for analysis and automation tasks.
Instructions
Get detailed page information including full HTML content, page statistics, and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | Yes | Instance ID |
Implementation Reference
- src/tools.ts:791-844 (handler)The core handler function for 'browser_get_page_info' that retrieves comprehensive page information including full HTML content, title, URL, statistics, and metadata from the browser page.private async getPageInfo(instanceId: string): Promise<ToolResult> { const instance = this.browserManager.getInstance(instanceId); if (!instance) { return { success: false, error: `Instance ${instanceId} not found` }; } try { const url = instance.page.url(); const title = await instance.page.title(); const content = await instance.page.content(); // Get additional page information const viewport = instance.page.viewportSize(); const loadState = await instance.page.evaluate(() => document.readyState); // Get basic page statistics const pageStats = await instance.page.evaluate(() => { const links = document.querySelectorAll('a[href]').length; const images = document.querySelectorAll('img').length; const forms = document.querySelectorAll('form').length; const scripts = document.querySelectorAll('script').length; const stylesheets = document.querySelectorAll('link[rel="stylesheet"]').length; return { linksCount: links, imagesCount: images, formsCount: forms, scriptsCount: scripts, stylesheetsCount: stylesheets }; }); return { success: true, data: { url, title, content, // Return complete HTML content contentLength: content.length, viewport, loadState, stats: pageStats, timestamp: new Date().toISOString() }, instanceId }; } catch (error) { return { success: false, error: `Get page info failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
- src/tools.ts:293-306 (schema)The input schema and metadata definition for the 'browser_get_page_info' tool, specifying the required instanceId parameter.{ name: 'browser_get_page_info', description: 'Get detailed page information including full HTML content, page statistics, and metadata', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' } }, required: ['instanceId'] } },
- src/tools.ts:553-554 (registration)The switch case in executeTools method that registers and dispatches the 'browser_get_page_info' tool call to its handler.case 'browser_get_page_info': return await this.getPageInfo(args.instanceId);