Skip to main content
Glama

browser_navigate

Directs a browser to a specified URL using Playwright sessions, enabling automated web navigation within isolated browser instances managed by the server.

Instructions

Navigate to URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • index.js:301-315 (registration)
    Registration of the 'browser_navigate' tool using server.tool, which proxies the call to a browser client.
    server.tool('browser_navigate', 'Navigate to URL', { url: z.string() },
      async (args, extra) => {
        log(`[browser_navigate] called with args: ${JSON.stringify(args)}`);
        try {
          const result = await proxyToolCall('browser_navigate', args);
          log(`[browser_navigate] result: ${JSON.stringify(result).slice(0, 500)}`);
          if (!result.isError) {
            hasActivePage = true; // Mark page as active after successful navigation
          }
          return result;
        } catch (err) {
          log(`[browser_navigate] ERROR: ${err.message}\n${err.stack}`);
          throw err;
        }
      });
  • The proxyToolCall function serves as the actual implementation handler that forwards tool execution requests (including 'browser_navigate') to the underlying MCP client.
    async function proxyToolCall(toolName, args) {
      log(`[proxyToolCall] ${toolName} with args: ${JSON.stringify(args)}`);
      const { client } = await getOrCreateInstance();
      log(`[proxyToolCall] got client for port ${assignedPort}`);
    
      // Update last used
      if (assignedPort && instances.has(assignedPort)) {
        instances.get(assignedPort).lastUsed = Date.now();
      }
    
      try {
        log(`[proxyToolCall] Calling client.callTool...`);
        const result = await client.callTool({ name: toolName, arguments: args || {} });
        log(`[proxyToolCall] Result type: ${typeof result}`);
        log(`[proxyToolCall] Result: ${JSON.stringify(result).slice(0, 500)}`);
    
        // The SDK returns { content: [...], isError?: boolean }
        // We need to return this same format
        if (result && result.content) {
          return result;
        }
    
        // Fallback: wrap in content array if needed
        return {
          content: [{ type: 'text', text: JSON.stringify(result) }]
        };
      } catch (error) {
        log(`[proxyToolCall] ERROR: ${error.message}\n${error.stack}`);
        return {
          content: [{ type: 'text', text: `Error: ${error.message}` }],
          isError: true
        };

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/OMGEverdo/browser-pool-mcp'

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