browser_navigate
Navigate web browsers to specified URLs for automated testing and interaction with web pages using Playwright's browser automation capabilities.
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 main handler function that implements the logic for the 'browser_navigate' tool: ensures a tab is available, navigates to the specified URL using tab.navigate(), includes a snapshot in the response, and adds Playwright code snippets for reproduction.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)The schema definition for the 'browser_navigate' tool, specifying the tool name, title, description, Zod input schema requiring a 'url' string, and marking it as a destructive operation.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 the 'browser_navigate' tool by importing the navigate module (line 24, not shown) and including it via spread operator in the allTools array, which collects all available tools for the backend.export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
- src/browserServerBackend.ts:52-59 (registration)MCP server backend's callTool method that dispatches tool calls by name: finds the tool by schema.name ('browser_navigate'), invokes its handle function with context and arguments, and serializes the response.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(); }
- src/browserServerBackend.ts:39-42 (registration)Initialization of the tool list in the BrowserServerBackend constructor by calling filteredTools(config), which includes 'browser_navigate' based on capabilities, and passes tools to Context.constructor(config: FullConfig, browserContextFactory: BrowserContextFactory) { this._tools = filteredTools(config); this._context = new Context(this._tools, config, browserContextFactory); }