navigate
Navigate to specified URLs for browser automation and web testing on ARM64 devices, enabling website interaction and UI testing.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to navigate to |
Implementation Reference
- index-browser-only.js:319-326 (handler)The main handler function that executes the navigation by ensuring Chromium is running and sending a Page.navigate CDP command.async navigate(url) { await this.ensureChromium(); await this.sendCDPCommand('Page.navigate', { url }); return { content: [{ type: 'text', text: `Successfully navigated to ${url}` }], }; }
- index-browser-only.js:103-112 (schema)Input schema defining the required 'url' parameter as a string for the navigate tool.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The URL to navigate to', }, }, required: ['url'], },
- index-browser-only.js:100-113 (registration)Tool registration entry in the ListTools response, including name, description, and schema.{ name: 'navigate', description: 'Navigate to a URL', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The URL to navigate to', }, }, required: ['url'], }, },
- index-browser-only.js:178-180 (registration)Dispatch registration in the CallToolRequest handler switch statement that routes to the navigate handler.case 'navigate': return await this.navigate(args.url); case 'get_content':
- index-browser-only.js:209-243 (helper)Helper function to send Chrome DevTools Protocol (CDP) commands over WebSocket, used by the navigate handler.async sendCDPCommand(method, params = {}) { return new Promise((resolve, reject) => { if (!wsConnection || wsConnection.readyState !== WebSocket.OPEN) { reject(new Error('No browser connection available')); return; } const commandId = Date.now(); const command = { id: commandId, method, params }; const timeout = setTimeout(() => { reject(new Error(`CDP command timeout: ${method}`)); }, 10000); const messageHandler = (data) => { try { const response = JSON.parse(data.toString()); if (response.id === commandId) { clearTimeout(timeout); wsConnection.off('message', messageHandler); if (response.error) { reject(new Error(`CDP error: ${response.error.message}`)); } else { resolve(response.result); } } } catch (error) { // Ignore parsing errors for non-matching messages } }; wsConnection.on('message', messageHandler); wsConnection.send(JSON.stringify(command)); }); }