get_content
Extract HTML or text content from web pages for browser automation and testing 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.js:701-720 (handler)Main handler function for the get_content tool. Retrieves HTML via DOM commands or text via JS evaluation using Chrome DevTools Protocol (CDP).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 }], }; }
- index.js:184-198 (schema)Input schema definition for get_content tool in the ListToolsRequestSchema response. Specifies optional 'type' parameter.{ 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:361-362 (registration)Tool handler registration/dispatch in the CallToolRequestSchema switch statement.case 'get_content': return await this.getContent(args.type || 'text');
- index-browser-only.js:328-348 (handler)Alternative handler for browser-only MCP server. Similar CDP-based content retrieval.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-browser-only.js:115-127 (schema)Input schema for get_content in browser-only server.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', }, }, },