browsercat_navigate
Navigate to any URL using BrowserCat's cloud browser service to automate web browsing tasks without local browser installation.
Instructions
Navigate to a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes |
Implementation Reference
- index.ts:171-179 (handler)The handler logic for the 'browsercat_navigate' tool. It navigates the browser page to the specified URL using Puppeteer's page.goto method and returns a textual confirmation.case "browsercat_navigate": await page.goto(args.url); return { content: [{ type: "text", text: `Navigated to ${args.url}`, }], isError: false, };
- index.ts:29-39 (schema)The schema definition for the 'browsercat_navigate' tool, specifying the input schema that requires a 'url' string parameter.{ name: "browsercat_navigate", description: "Navigate to a URL", inputSchema: { type: "object", properties: { url: { type: "string" }, }, required: ["url"], }, },
- index.ts:421-423 (registration)Registration of the ListToolsRequestSchema handler, which exposes the list of available tools including 'browsercat_navigate'.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- index.ts:425-427 (registration)Registration of the CallToolRequestSchema handler, which routes tool calls to the handleToolCall function based on the tool name.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}) );
- index.ts:122-152 (helper)Helper function ensureBrowser() that initializes and connects to the BrowserCat remote browser instance via Puppeteer if not already done, sets up console logging, and returns the active page instance used by the navigate handler.async function ensureBrowser() { if (!browser) { // Connect to BrowserCat remote browser using the correct endpoint and header format const browsercatEndpoint = 'wss://api.browsercat.com/connect'; browser = await puppeteer.connect({ browserWSEndpoint: browsercatEndpoint, headers: { 'Api-Key': requiredEnvVars.BROWSERCAT_API_KEY! } }); const pages = await browser.pages(); if (pages.length === 0) { page = await browser.newPage(); } else { page = pages[0]; } // Capture console logs from the browser page.on("console", (msg) => { const logEntry = `[${msg.type()}] ${msg.text()}`; consoleLogs.push(logEntry); server.notification({ method: "notifications/resources/updated", params: { uri: "console://logs" }, }); }); } return page!; }