Skip to main content
Glama

navigate_to_url

Navigate to a specified URL while preserving browser session data like cookies and authentication state. Use this tool to move between different website sections or pages during web application analysis and automation.

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 executes the navigation logic using Puppeteer's page.goto method, handles errors, updates the session's current URL, and returns success details including 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 tool schema definition in the ListTools response, including name, description, and detailed inputSchema with parameter types, descriptions, defaults, and required fields.
    {
      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-510 (registration)
    Registration and dispatching logic in the CallToolRequestSchema handler's switch statement, including parameter validation and call to the navigateToUrl handler.
    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;
  • Re-export of the navigateToUrl function from its implementation module (navigation.js) to the central tools export file, enabling easy import in index.js.
    export { navigateToUrl, switchTab } from "./navigation.js";
  • src/index.js:12-26 (registration)
    Import of the navigateToUrl function (via re-export) into the main index.js file where tool handlers are set up.
      reverseEngineerChat,
      takeScreenshot,
      clickElement,
      fillForm,
      switchTab,
      waitForElement,
      navigateToUrl,
      getCurrentPageInfo,
      initializeSession,
      closeSession,
      startNetworkCapture,
      stopNetworkCapture,
      getNetworkCaptureStatus,
      clearNetworkCapture,
    } from "./tools/reverseEngineer.js";
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: maintaining cookies/authentication state and supporting wait strategies for page load. However, it lacks details on error handling, timeouts, or what happens if navigation fails, which are important for a navigation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with three sentences: first states the core action, second explains session persistence, third provides usage context and wait strategy support. Every sentence adds value without redundancy, making it front-loaded and appropriately sized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description does well by covering session persistence and wait strategies. However, for a navigation tool, it could benefit from mentioning potential side effects (e.g., page reloads, JavaScript execution) or return values, though the lack of output schema lowers expectations slightly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain URL formatting or sessionId usage further). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Navigate to a different URL') and resource ('within the same browser session'), distinguishing it from sibling tools like 'initialize_session' (creates session) or 'switch_tab' (changes tab). It explicitly mentions maintaining session state, which further clarifies its purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Useful for moving between different sections of a website') with concrete examples (e.g., login page to chat page). However, it does not explicitly state when NOT to use it or name alternatives like 'switch_tab' for tab management, which would elevate it to a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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