navigate
Directs a web browser to a specific URL, enabling automated web page access for testing, scraping, or interaction tasks.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes |
Implementation Reference
- src/controllers/playwright.ts:73-85 (handler)Core handler function that performs the browser navigation using Playwright's page.goto() method.async navigate(url: string): Promise<void> { try { if (!this.isInitialized()) { throw new Error('Browser not initialized'); } this.log('Navigating to', url); await this.state.page?.goto(url); this.log('Navigation complete'); } catch (error: any) { console.error('Navigation error:', error); throw new BrowserError('Failed to navigate', 'Check if the URL is valid and accessible'); } }
- src/server.ts:586-597 (handler)MCP tool dispatch handler in callTool that validates input and invokes the controller's navigate method.case 'navigate': { if (!args.url || typeof args.url !== 'string') { return { content: [{ type: "text", text: "URL is required" }], isError: true }; } await playwrightController.navigate(args.url); return { content: [{ type: "text", text: "Navigation successful" }] }; }
- src/server.ts:19-29 (schema)Tool schema definition including name, description, and input schema requiring a 'url' string.const NAVIGATE_TOOL: Tool = { name: "navigate", description: "Navigate to a URL", inputSchema: { type: "object", properties: { url: { type: "string" } }, required: ["url"] } };
- src/server.ts:516-516 (registration)Registration of the navigate tool in the tools object passed to MCP server capabilities.navigate: NAVIGATE_TOOL,