browser_navigate
Navigate to specified URLs to prepare web pages for automated screenshot capture, testing, or monitoring purposes.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to navigate to | |
| waitUntil | No | When to consider navigation complete | networkidle2 |
Implementation Reference
- src/index.ts:234-249 (handler)Handler for the browser_navigate tool. Ensures a browser page is available, navigates to the specified URL with optional waitUntil option, and returns a success message.case 'browser_navigate': { const { page } = await ensureBrowser(); const url = args?.url as string; const waitUntil = (args?.waitUntil as any) || 'networkidle2'; await page.goto(url, { waitUntil }); return { content: [ { type: 'text', text: `Navigated to ${url}`, }, ], }; }
- src/index.ts:110-130 (schema)Input schema for browser_navigate tool, requiring a URL and optionally specifying waitUntil navigation completion condition.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to navigate to', }, waitUntil: { type: 'string', enum: [ 'load', 'domcontentloaded', 'networkidle0', 'networkidle2', ], description: 'When to consider navigation complete', default: 'networkidle2', }, }, required: ['url'], },
- src/index.ts:107-131 (registration)Registration of the browser_navigate tool in the ListTools response, including name, description, and input schema.{ name: 'browser_navigate', description: 'Navigate to a URL', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to navigate to', }, waitUntil: { type: 'string', enum: [ 'load', 'domcontentloaded', 'networkidle0', 'networkidle2', ], description: 'When to consider navigation complete', default: 'networkidle2', }, }, required: ['url'], }, },
- src/index.ts:70-88 (helper)Helper function ensureBrowser() used by browser_navigate handler to launch or reuse a Puppeteer browser and page instance.async function ensureBrowser(): Promise<{ browser: Browser; page: Page }> { if (!browserState.browser || !browserState.browser.isConnected()) { const headless = process.env.HEADLESS !== 'false'; browserState.browser = await puppeteer.launch({ headless, args: ['--no-sandbox', '--disable-setuid-sandbox'], }); browserState.page = await browserState.browser.newPage(); } if (!browserState.page || browserState.page.isClosed()) { browserState.page = await browserState.browser.newPage(); } return { browser: browserState.browser, page: browserState.page, }; }