Files
MCP-Browser/tools/getLinks.js
T
jfeng d8796531ee feat: MCP Browser v3.1.1 - 56+ tools, visual overlays, fixes
- Added 9 new tools: visual overlay, highlight, toast, drag-drop, etc.
- Fixed evaluateJS to support function arguments
- Fixed hover for non-visible elements
- Fixed storage operations with try/catch
- Added 10 new wait tools: clickable, element visible, text
- Fixed tool name mapping in server.js for MCP protocol
- Updated README with 60+ tools documentation
- Version bump to 3.1.1
2026-04-07 16:29:38 -03:00

13 lines
483 B
JavaScript

const browser = require('../browser');
module.exports = async ({ selector = 'a' }) => {
const p = await browser.ensurePage();
const links = await p.evaluate((sel) => {
return Array.from(document.querySelectorAll(sel)).map(el => ({
text: (el.innerText || el.textContent || '').trim(),
href: el.href || el.getAttribute('href') || ''
})).filter(link => link.href);
}, selector);
return { success: true, action: 'get_links', count: links.length, links };
};