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
| Name | Required | Description | Default |
|---|---|---|---|
| direction | Yes | back or forward |
Implementation Reference
- src/tools/utilities.ts:119-140 (handler)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); } }
- src/tools/utilities.ts:33-47 (schema)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,
- src/tools/index.ts:76-80 (registration)Re-export of navigateHistoryTool and handleNavigateHistory from utilities.ts for central import in src/index.ts.navigateHistoryTool, setViewportSizeTool, handleAcceptDialog, handleDismissDialog, handleNavigateHistory,