Skip to main content
Glama
andytango
by andytango

navigate

Directs a browser to load a specific webpage, allowing automation of web navigation tasks with configurable loading conditions and timeouts.

Instructions

Navigate to a URL in the browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to navigate to
waitUntilNoWhen to consider navigation complete
timeoutNoTimeout in milliseconds
tabIdNoTab ID to operate on (uses active tab if not specified)

Implementation Reference

  • The handler function for the 'navigate' tool. It retrieves the page for the given tabId, navigates to the URL using page.goto(), handles navigation responses, errors like timeouts and failed HTTP statuses, and returns the final URL, title, and status.
    async ({ url, waitUntil, timeout, tabId }) => {
      const pageResult = await getPageForOperation(tabId);
      if (!pageResult.success) {
        return handleResult(pageResult);
      }
    
      const page = pageResult.data;
      const timeoutMs = timeout ?? getDefaultTimeout();
    
      try {
        const response = await page.goto(url, {
          waitUntil: (waitUntil ?? 'load') as WaitUntilOption,
          timeout: timeoutMs,
        });
    
        if (!response) {
          return handleResult(err(navigationFailed(url, 'No response received')));
        }
    
        const status = response.status();
        if (status >= 400) {
          return handleResult(err(navigationFailed(url, `HTTP ${status}`)));
        }
    
        return handleResult(ok({
          url: page.url(),
          title: await page.title(),
          status,
        }));
      } catch (error) {
        if (error instanceof Error && error.message.includes('timeout')) {
          return handleResult(err(navigationTimeout(url, timeoutMs)));
        }
        return handleResult(err(normalizeError(error)));
      }
    }
  • Zod schema defining the input parameters for the 'navigate' tool: required URL, optional waitUntil, timeout, and tabId.
    export const navigateSchema = z.object({
      url: z.string().url().describe('URL to navigate to'),
      waitUntil: waitUntilSchema.describe('When to consider navigation complete'),
      timeout: timeoutSchema,
      tabId: tabIdSchema,
    });
  • Registration of the 'navigate' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      'navigate',
      'Navigate to a URL in the browser',
      navigateSchema.shape,
      async ({ url, waitUntil, timeout, tabId }) => {
        const pageResult = await getPageForOperation(tabId);
        if (!pageResult.success) {
          return handleResult(pageResult);
        }
    
        const page = pageResult.data;
        const timeoutMs = timeout ?? getDefaultTimeout();
    
        try {
          const response = await page.goto(url, {
            waitUntil: (waitUntil ?? 'load') as WaitUntilOption,
            timeout: timeoutMs,
          });
    
          if (!response) {
            return handleResult(err(navigationFailed(url, 'No response received')));
          }
    
          const status = response.status();
          if (status >= 400) {
            return handleResult(err(navigationFailed(url, `HTTP ${status}`)));
          }
    
          return handleResult(ok({
            url: page.url(),
            title: await page.title(),
            status,
          }));
        } catch (error) {
          if (error instanceof Error && error.message.includes('timeout')) {
            return handleResult(err(navigationTimeout(url, timeoutMs)));
          }
          return handleResult(err(normalizeError(error)));
        }
      }
    );
  • src/server.ts:23-23 (registration)
    High-level registration call that includes the 'navigate' tool among navigation tools.
    registerNavigationTools(server);
Behavior2/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. 'Navigate to a URL in the browser' implies a navigation action but doesn't describe what happens after navigation (does it wait for page load?), whether it opens new tabs, what happens on errors, or any side effects. This leaves significant behavioral gaps 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 a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized and front-loaded with the essential information.

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

Completeness2/5

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

For a navigation tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after navigation completes, what the tool returns, error conditions, or how it interacts with the browser context. Given the complexity and lack of structured metadata, more descriptive context is needed.

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?

With 100% schema description coverage, the schema already documents all 4 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline expectation but doesn't provide extra value.

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

Purpose4/5

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

The description clearly states the action ('Navigate to') and resource ('a URL in the browser'), making the purpose immediately understandable. However, it doesn't distinguish this from sibling tools like 'reload', 'go_back', or 'go_forward' which are also navigation-related operations.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'reload', 'go_back', 'go_forward', and 'wait_for_navigation', there's no indication of when navigation is preferred over these other options or what the prerequisites might be.

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/andytango/puppeteer-mcp'

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