go_forward
Navigate forward in browser history to return to previously visited pages, with options to control timing and specify tabs for automation workflows.
Instructions
Navigate forward in browser history
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| waitUntil | No | ||
| timeout | No | Timeout in milliseconds | |
| tabId | No | Tab ID to operate on (uses active tab if not specified) |
Implementation Reference
- src/tools/navigation.ts:126-148 (handler)Handler function that executes the go_forward tool: retrieves the browser page, performs page.goForward() with options, handles success/error responses.async ({ waitUntil, timeout, tabId }) => { const pageResult = await getPageForOperation(tabId); if (!pageResult.success) { return handleResult(pageResult); } const page = pageResult.data; try { const response = await page.goForward({ waitUntil: (waitUntil ?? 'load') as WaitUntilOption, timeout: timeout ?? getDefaultTimeout(), }); return handleResult(ok({ url: page.url(), title: await page.title(), navigated: response !== null, })); } catch (error) { return handleResult(err(normalizeError(error))); } }
- src/tools/navigation.ts:122-149 (registration)Registers the 'go_forward' MCP tool with server.tool(), including description, input schema shape, and inline handler function.server.tool( 'go_forward', 'Navigate forward in browser history', goForwardSchema.shape, async ({ waitUntil, timeout, tabId }) => { const pageResult = await getPageForOperation(tabId); if (!pageResult.success) { return handleResult(pageResult); } const page = pageResult.data; try { const response = await page.goForward({ waitUntil: (waitUntil ?? 'load') as WaitUntilOption, timeout: timeout ?? getDefaultTimeout(), }); return handleResult(ok({ url: page.url(), title: await page.title(), navigated: response !== null, })); } catch (error) { return handleResult(err(normalizeError(error))); } } );
- src/schemas.ts:44-48 (schema)Zod object schema defining input parameters for the go_forward tool: waitUntil (enum), timeout (number), tabId (string optional).export const goForwardSchema = z.object({ waitUntil: waitUntilSchema, timeout: timeoutSchema, tabId: tabIdSchema, });