Skip to main content
Glama

navigate_to_url

Navigate to different URLs within the same browser session while preserving cookies, authentication state, and session data. Enables moving between website sections like from login to chat pages with configurable page load strategies.

Instructions

Navigate to a different URL within the same browser session. Maintains all cookies, authentication state, and session data. Useful for moving between different sections of a website (e.g., from login page to chat page, or from homepage to a specific conversation URL). Supports different wait strategies for page load completion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID obtained from initialize_session
urlYesComplete URL to navigate to (e.g., 'https://chat.example.com/conversation/new')
waitUntilNoPage load strategy: 'load' (wait for load event), 'domcontentloaded' (wait for DOM ready), 'networkidle' (wait for network to be idle). Use 'networkidle' for SPAs (default: 'load')load

Implementation Reference

  • The core handler function that navigates the browser page to the specified URL using Puppeteer, updates the session's current URL, and returns navigation details including success status, current URL, and page title.
    export async function navigateToUrl(sessionId, url, waitUntil = "load") { const session = getSession(sessionId); const { page } = session; try { await page.goto(url, { waitUntil, timeout: 30000 }); session.currentUrl = url; return { success: true, sessionId, currentUrl: page.url(), title: await page.title(), message: "Navigation successful", }; } catch (error) { throw new Error(`Failed to navigate: ${error.message}`); } }
  • The input schema definition for the navigate_to_url tool in the ListTools response, specifying parameters: sessionId (required), url (required), waitUntil (optional with default 'load').
    { name: "navigate_to_url", description: "Navigate to a different URL within the same browser session. Maintains all cookies, authentication state, and session data. Useful for moving between different sections of a website (e.g., from login page to chat page, or from homepage to a specific conversation URL). Supports different wait strategies for page load completion.", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "Session ID obtained from initialize_session", }, url: { type: "string", description: "Complete URL to navigate to (e.g., 'https://chat.example.com/conversation/new')", }, waitUntil: { type: "string", description: "Page load strategy: 'load' (wait for load event), 'domcontentloaded' (wait for DOM ready), 'networkidle' (wait for network to be idle). Use 'networkidle' for SPAs (default: 'load')", default: "load", }, }, required: ["sessionId", "url"], }, },
  • src/index.js:495-511 (registration)
    The registration and dispatch logic in the CallToolRequestSchema handler's switch statement, which validates arguments and invokes the navigateToUrl handler function.
    case "navigate_to_url": { const { sessionId, url, waitUntil = "load" } = args; if (!sessionId) { throw new McpError( ErrorCode.InvalidParams, "sessionId parameter is required" ); } if (!url) { throw new McpError( ErrorCode.InvalidParams, "url parameter is required" ); } result = await navigateToUrl(sessionId, url, waitUntil); break; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pyscout/webscout-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server