Skip to main content
Glama
freema
by freema

navigate_history

Navigate browser history backward or forward to test web application flows, automate navigation sequences, or control browsing direction during automation tasks.

Instructions

Navigate history back/forward. UIDs become stale.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesback or forward

Implementation Reference

  • Handler function that implements the navigate_history tool logic: validates direction ('back' or 'forward'), gets Firefox instance, calls navigateBack() or navigateForward(), and returns success or error response.
    export async function handleNavigateHistory(args: unknown): Promise<McpToolResponse> {
      try {
        const { direction } = args as { direction: 'back' | 'forward' };
    
        if (!direction || (direction !== 'back' && direction !== 'forward')) {
          throw new Error('direction parameter is required and must be "back" or "forward"');
        }
    
        const { getFirefox } = await import('../index.js');
        const firefox = await getFirefox();
    
        if (direction === 'back') {
          await firefox.navigateBack();
        } else {
          await firefox.navigateForward();
        }
    
        return successResponse(`✅ ${direction}`);
      } catch (error) {
        return errorResponse(error as Error);
      }
    }
  • Tool definition object for 'navigate_history' including name, description, and inputSchema for MCP validation (requires 'direction' as 'back' or 'forward').
    export const navigateHistoryTool = {
      name: 'navigate_history',
      description: 'Navigate history back/forward. UIDs become stale.',
      inputSchema: {
        type: 'object',
        properties: {
          direction: {
            type: 'string',
            enum: ['back', 'forward'],
            description: 'back or forward',
          },
        },
        required: ['direction'],
      },
    };
  • src/index.ts:145-145 (registration)
    Registration of the navigate_history handler in the toolHandlers Map used by the MCP server.
    ['navigate_history', tools.handleNavigateHistory],
  • src/index.ts:189-189 (registration)
    Registration of the navigateHistoryTool schema in the allTools array returned by ListToolsRequest.
    tools.navigateHistoryTool,
  • Re-export of navigateHistoryTool and handleNavigateHistory from utilities.ts for central import in src/index.ts.
    navigateHistoryTool,
    setViewportSizeTool,
    handleAcceptDialog,
    handleDismissDialog,
    handleNavigateHistory,

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