pilot_page_links
Extract all links from a webpage as text and URL pairs for automated navigation and content analysis.
Instructions
Get all links on the page as text + href pairs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/page.ts:61-80 (handler)The 'pilot_page_links' tool implementation which extracts and formats links from the current browser page.
server.tool( 'pilot_page_links', 'Get all links on the page as text + href pairs.', {}, async () => { await bm.ensureBrowser(); try { const links = await bm.getPage().evaluate(() => [...document.querySelectorAll('a[href]')].map(a => ({ text: a.textContent?.trim().slice(0, 120) || '', href: (a as HTMLAnchorElement).href, })).filter(l => l.text && l.href) ); const result = links.map(l => `${l.text} → ${l.href}`).join('\n'); return { content: [{ type: 'text' as const, text: result || '(no links found)' }] }; } catch (err) { return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true }; } } );