navigate
Directs a web browser to a specified URL, enabling automated web navigation and interaction for data retrieval and task execution.
Instructions
Navigate to a specified URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL to navigate to |
Implementation Reference
- src/index.ts:602-620 (handler)The core handler function implementing the 'navigate' tool logic: validates URL, adds https:// if needed, calls page.goto(url), and returns success message.async function handleNavigate(page: Page, args: any): Promise<CallToolResult> { let { url } = args; if (!url) { return { isError: true, content: [ { type: "text", text: "URL parameter is required for navigation" }, ], }; } if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "https://" + url; } await page.goto(url); return { isError: false, content: [{ type: "text", text: `Navigated to ${url}` }], }; }
- src/index.ts:459-465 (schema)Input schema for the 'navigate' tool, requiring a 'url' string parameter.inputSchema: { type: "object", properties: { url: { type: "string", description: "The URL to navigate to" }, }, required: ["url"], },
- src/index.ts:456-466 (registration)Registration of the 'navigate' tool in the TOOLS array, including name, description, and input schema.{ name: "navigate", description: "Navigate to a specified URL", inputSchema: { type: "object", properties: { url: { type: "string", description: "The URL to navigate to" }, }, required: ["url"], }, },
- src/index.ts:916-917 (registration)Switch case in the main tool dispatcher (handleToolCall) that invokes the navigate handler.case "navigate": result = await handleNavigate(page, args);
- src/index.ts:1068-1071 (registration)MCP server request handler for listing tools, exposing the 'navigate' tool via the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));