browser_navigate
Directs automated browsers to a specified URL within the Playwright MCP, enabling structured web page interactions without screenshots or vision models.
Instructions
Navigate to a URL
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to navigate to |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"url": {
"description": "The URL to navigate to",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/tools/navigate.ts:33-46 (handler)The core handler function that executes the browser_navigate tool: parses input URL, navigates the current tab, and returns a generated Playwright code snippet.handle: async (context, params) => { const validatedParams = navigateSchema.parse(params); const currentTab = await context.ensureTab(); return await currentTab.run(async tab => { await tab.navigate(validatedParams.url); const code = [ `// Navigate to ${validatedParams.url}`, `await page.goto('${validatedParams.url}');`, ]; return { code }; }, { captureSnapshot, }); },
- src/tools/navigate.ts:22-24 (schema)Zod schema defining the input parameters for the browser_navigate tool (URL string). Converted to JSON schema for MCP.const navigateSchema = z.object({ url: z.string().describe('The URL to navigate to'), });
- src/index.ts:37-47 (registration)Registration of browser_navigate (via ...navigate(true)) in the snapshotTools array used for MCP server creation.const snapshotTools: Tool[] = [ ...common(true), ...console, ...files(true), ...install, ...keyboard(true), ...navigate(true), ...pdf, ...snapshot, ...tabs(true), ];
- src/index.ts:49-59 (registration)Registration of browser_navigate (via ...navigate(false)) in the screenshotTools array used for MCP server creation.const screenshotTools: Tool[] = [ ...common(false), ...console, ...files(false), ...install, ...keyboard(false), ...navigate(false), ...pdf, ...screen, ...tabs(false), ];
- src/tools/navigate.ts:28-32 (schema)The tool schema object including name, description, and input schema for MCP protocol compliance.schema: { name: 'browser_navigate', description: 'Navigate to a URL', inputSchema: zodToJsonSchema(navigateSchema), },