playwright_navigate
Navigate to a specified URL in a browser with configurable viewport settings, timeout, and wait conditions for web automation tasks.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| width | No | Viewport width in pixels (default: 1920) | |
| height | No | Viewport height in pixels (default: 1080) | |
| timeout | No | Navigation timeout in milliseconds | |
| waitUntil | No | Navigation wait condition |
Implementation Reference
- src/toolsHandler.ts:86-107 (handler)Handler function for the playwright_navigate tool, performs page navigation using Playwright's goto method.case "playwright_navigate": try { await page!.goto(args.url, { timeout: args.timeout || 30000, waitUntil: args.waitUntil || "load" }); return { content: [{ type: "text", text: `Navigated to ${args.url}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Navigation failed: ${(error as Error).message}`, }], isError: true, }; }
- src/tools.ts:5-19 (schema)Input schema definition for the playwright_navigate tool, specifying parameters like url, viewport size, timeout, and waitUntil.{ name: "playwright_navigate", description: "Navigate to a URL", inputSchema: { type: "object", properties: { url: { type: "string" }, width: { type: "number", description: "Viewport width in pixels (default: 1920)" }, height: { type: "number", description: "Viewport height in pixels (default: 1080)" }, timeout: { type: "number", description: "Navigation timeout in milliseconds" }, waitUntil: { type: "string", description: "Navigation wait condition" } }, required: ["url"], }, },
- src/requestHandler.ts:60-62 (registration)Registers the list tools request handler, which returns the array of tool definitions including playwright_navigate.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/requestHandler.ts:65-67 (registration)Registers the call tool request handler, which dispatches to the specific tool handler based on name, including playwright_navigate.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );
- src/tools.ts:156-164 (helper)Helper array listing browser-requiring tools, including playwright_navigate, used to conditionally launch the browser.export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];