get_content
Extract HTML or text content from web pages for browser automation and testing workflows on ARM64 devices.
Instructions
Get page content (HTML or text)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Type of content to get | text |
Implementation Reference
- index-browser-only.js:115-171 (registration)Registration of the 'get_content' tool in the ListToolsRequestSchema handler, including name, description, and input schema.name: 'get_content', description: 'Get page content (HTML or text)', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['html', 'text'], description: 'Type of content to get', default: 'text', }, }, }, }, { name: 'screenshot', description: 'Take a screenshot of the current page', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the screenshot file', default: 'screenshot.png', }, fullPage: { type: 'boolean', description: 'Capture full page', default: false, }, }, }, }, { name: 'evaluate', description: 'Execute JavaScript in the browser (read-only operations)', inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'JavaScript code to execute (for reading page info)', }, }, required: ['script'], }, }, { name: 'close_browser', description: 'Close the browser instance', inputSchema: { type: 'object', properties: {}, }, }, ], }));
- index-browser-only.js:328-348 (handler)Core handler implementation for get_content tool. Uses CDP commands to fetch either full HTML or body text content from the browser page.async getContent(type = 'text') { await this.ensureChromium(); if (type === 'html') { const result = await this.sendCDPCommand('DOM.getDocument'); const html = await this.sendCDPCommand('DOM.getOuterHTML', { nodeId: result.root.nodeId, }); return { content: [{ type: 'text', text: html.outerHTML }], }; } else { const result = await this.sendCDPCommand('Runtime.evaluate', { expression: 'document.body.innerText', returnByValue: true, }); return { content: [{ type: 'text', text: result.result.value || '' }], }; } }
- index.js:185-198 (registration)Tool registration in ListToolsRequestSchema for the full-featured server, defining name, description, and input schema.name: 'get_content', description: 'Get page content (HTML or text)', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['html', 'text'], description: 'Type of content to get', default: 'text', }, }, }, },
- index.js:701-720 (handler)Primary handler for get_content in the comprehensive Chromium MCP server. Retrieves page content as HTML or text using DevTools Protocol.async getContent(type) { await this.ensureChromium(); let content; if (type === 'html') { const doc = await this.sendCDPCommand('DOM.getDocument'); const html = await this.sendCDPCommand('DOM.getOuterHTML', { nodeId: doc.root.nodeId }); content = html.outerHTML; } else { const result = await this.sendCDPCommand('Runtime.evaluate', { expression: 'document.body.innerText', returnByValue: true }); content = result.result?.value || ''; } return { content: [{ type: 'text', text: content }], }; }