navigate_history
Navigate browser history back or forward in the selected tab to test navigation flows, verify page states, or automate browsing sequences.
Instructions
Navigate the selected tab's history back or forward. NOTE: After navigation, UIDs from previous snapshots are stale—take a new snapshot before UID-based actions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| direction | Yes | Direction to navigate in history |
Implementation Reference
- src/tools/utilities.ts:119-140 (handler)The handler function that implements the core logic for the 'navigate_history' tool, performing back or forward navigation in the browser history using Firefox DevTools.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); } }
- src/tools/utilities.ts:33-47 (schema)The tool schema definition including name, description, and input schema for the 'navigate_history' tool.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' tool handler in the central toolHandlers Map used for tool execution.['navigate_history', tools.handleNavigateHistory],
- src/index.ts:189-189 (registration)Inclusion of the 'navigate_history' tool definition in the allTools array used for listing available tools.tools.navigateHistoryTool,