Skip to main content
Glama
freema
by freema

navigate_page

Directs a Firefox browser tab to a specified URL for automated testing, web scraping, or browser control tasks.

Instructions

Navigate selected tab to URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesTarget URL

Implementation Reference

  • The main handler function that executes the 'navigate_page' tool. It validates the 'url' input, gets the Firefox instance, refreshes tabs, checks the selected tab, navigates to the URL, and returns a success response.
    export async function handleNavigatePage(args: unknown): Promise<McpToolResponse> {
      try {
        const { url } = args as { url: string };
    
        if (!url || typeof url !== 'string') {
          throw new Error('url parameter is required and must be a string');
        }
    
        const { getFirefox } = await import('../index.js');
        const firefox = await getFirefox();
    
        // Refresh tabs to get latest list
        await firefox.refreshTabs();
        const tabs = firefox.getTabs();
        const selectedIdx = firefox.getSelectedTabIdx();
        const page = tabs[selectedIdx];
    
        if (!page) {
          throw new Error('No page selected');
        }
    
        await firefox.navigate(url);
    
        return successResponse(`✅ [${selectedIdx}] → ${url}`);
      } catch (error) {
        return errorResponse(error as Error);
      }
    }
  • The schema definition for the 'navigate_page' tool, specifying the name, description, and input schema requiring a 'url' string.
    export const navigatePageTool = {
      name: 'navigate_page',
      description: 'Navigate selected tab to URL.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'Target URL',
          },
        },
        required: ['url'],
      },
    };
  • src/index.ts:110-110 (registration)
    Registration of the 'navigate_page' handler in the toolHandlers Map, mapping the tool name to its execution function.
    ['navigate_page', tools.handleNavigatePage],
  • src/index.ts:154-154 (registration)
    Registration of the 'navigate_page' tool schema in the allTools array, used for listing available tools.
    tools.navigatePageTool,
  • Re-export of the 'navigate_page' tool schema (navigatePageTool) and handler (handleNavigatePage) from pages.ts, making them available centrally.
    export {
      listPagesTool,
      newPageTool,
      navigatePageTool,
      selectPageTool,
      closePageTool,
      handleListPages,
      handleNewPage,
      handleNavigatePage,
      handleSelectPage,
      handleClosePage,
    } from './pages.js';

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/freema/firefox-devtools-mcp'

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