go_back
Navigate back in browser history to return to the previous page, with options to wait for page load events and set timeout limits.
Instructions
Navigate back 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:96-117 (handler)Handler function that executes the go_back tool: gets the page, calls page.goBack() with options, handles errors, and returns navigation result including URL, title, and whether navigated.async ({ waitUntil, timeout, tabId }) => { const pageResult = await getPageForOperation(tabId); if (!pageResult.success) { return handleResult(pageResult); } const page = pageResult.data; try { const response = await page.goBack({ 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:92-118 (registration)Registration of the 'go_back' tool on the MCP server, including name, description, input schema, and handler.server.tool( 'go_back', 'Navigate back in browser history', goBackSchema.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.goBack({ 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:38-42 (schema)Zod schema defining the input parameters for the go_back tool: optional waitUntil, timeout, and tabId.export const goBackSchema = z.object({ waitUntil: waitUntilSchema, timeout: timeoutSchema, tabId: tabIdSchema, });