browser_navigate
Directs a browser to a specified URL, enabling web page navigation within Playwright MCP for structured accessibility interactions.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to navigate to |
Implementation Reference
- src/tools/navigate.ts:33-40 (handler)The handler function that performs the browser navigation to the given URL using the current tab, includes snapshot and generates code snippet.handle: async (context, params, response) => { const tab = await context.ensureTab(); await tab.navigate(params.url); response.setIncludeSnapshot(); response.addCode(`// Navigate to ${params.url}`); response.addCode(`await page.goto('${params.url}');`); },
- src/tools/navigate.ts:23-31 (schema)Zod schema definition for the browser_navigate tool input parameters.schema: { 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.ts:36-52 (registration)Registration of browser_navigate tool by including the navigate module in the allTools export array used by the MCP server backend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/context.ts:83-88 (helper)Context helper method ensureTab() called by the browser_navigate handler to ensure a tab is available for navigation.async ensureTab(): Promise<Tab> { const { browserContext } = await this._ensureBrowserContext(); if (!this._currentTab) await browserContext.newPage(); return this._currentTab!; }
- src/browserServerBackend.ts:52-59 (registration)MCP ServerBackend callTool method that dispatches to the specific tool handler (including browser_navigate) based on name.async callTool(schema: mcpServer.ToolSchema<any>, parsedArguments: any) { const response = new Response(this._context, schema.name, parsedArguments); const tool = this._tools.find(tool => tool.schema.name === schema.name)!; await tool.handle(this._context, parsedArguments, response); if (this._sessionLog) await this._sessionLog.log(response); return await response.serialize(); }