browser_navigate
Navigate web browsers to specific URLs using Playwright automation, enabling programmatic web page interaction through structured accessibility snapshots.
Instructions
Navigate to a URL
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to navigate to |
Implementation Reference
- src/tools/navigate.ts:33-47 (handler)The core handler function for the 'browser_navigate' tool. It ensures an active tab, navigates to the provided URL, generates a corresponding Playwright code snippet, and instructs to capture a snapshot without waiting for network events.
handle: async (context, params) => { const tab = await context.ensureTab(); await tab.navigate(params.url); const code = [ `// Navigate to ${params.url}`, `await page.goto('${params.url}');`, ]; return { code, captureSnapshot, waitForNetwork: false, }; }, - src/tools/navigate.ts:24-31 (schema)Schema definition for the 'browser_navigate' tool, specifying the name, title, description, Zod input schema (url: string), and destructive type.
name: 'browser_navigate', title: 'Navigate to a URL', description: 'Navigate to a URL', inputSchema: z.object({ url: z.string().describe('The URL to navigate to'), }), type: 'destructive', }, - src/tools/navigate.ts:100-104 (registration)Module-level registration exporting a factory function that creates and returns the browser_navigate tool (along with back/forward) based on captureSnapshot parameter.
export default (captureSnapshot: boolean) => [ navigate(captureSnapshot), goBack(captureSnapshot), goForward(captureSnapshot), ]; - src/tools.ts:35-50 (registration)Registers the navigate tool factory into the snapshotTools array via spread operator ...navigate(true), collecting all core tools.
export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ]; - src/server.ts:20-23 (registration)In the Server constructor, selects and filters tools from snapshotTools/visionTools (including browser_navigate) and assigns to this.tools for MCP tool listing and calling.
constructor(config: FullConfig) { this.config = config; const allTools = config.vision ? visionTools : snapshotTools; this.tools = allTools.filter(tool => !config.capabilities || tool.capability === 'core' || config.capabilities.includes(tool.capability));