browser_navigate_back
Go back to the previous page in browsing history. Enables AI assistants to revert to the prior page after navigating forward, supporting multi-step tasks like form submission or link traversal.
Instructions
Go back to the previous page in the history
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/navigate.ts:50-74 (handler)The handler function for browser_navigate_back. It ensures a tab is available, calls page.goBack() on the Playwright page, and returns code, captureSnapshot, and waitForNetwork: false.
const goBack: ToolFactory = captureSnapshot => defineTool({ capability: 'history', schema: { name: 'browser_navigate_back', title: 'Go back', description: 'Go back to the previous page', inputSchema: z.object({}), type: 'readOnly', }, handle: async context => { const tab = await context.ensureTab(); await tab.page.goBack(); const code = [ `// Navigate back`, `await page.goBack();`, ]; return { code, captureSnapshot, waitForNetwork: false, }; }, }); - src/tools/navigate.ts:52-57 (schema)Schema definition for browser_navigate_back: name, title, description, empty input schema, and type 'readOnly'.
schema: { name: 'browser_navigate_back', title: 'Go back', description: 'Go back to the previous page', inputSchema: z.object({}), type: 'readOnly', - src/tools/navigate.ts:100-104 (registration)The navigate.ts module exports goBack (browser_navigate_back) as part of the default export array, registering it alongside navigate and goForward.
export default (captureSnapshot: boolean) => [ navigate(captureSnapshot), goBack(captureSnapshot), goForward(captureSnapshot), ]; - src/tools.ts:23-50 (registration)The navigate module (including browser_navigate_back) is imported in src/tools.ts and spread into the snapshotTools and visionTools arrays.
import navigate from './tools/navigate.js'; import network from './tools/network.js'; import pdf from './tools/pdf.js'; import snapshot from './tools/snapshot.js'; import tabs from './tools/tabs.js'; import screenshot from './tools/screenshot.js'; import testing from './tools/testing.js'; import vision from './tools/vision.js'; import wait from './tools/wait.js'; import type { Tool } from './tools/tool.js'; export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...wait(true), ]; - src/tools/tool.ts:66-68 (helper)The defineTool helper function used to create the tool definition, providing type safety.
export function defineTool<Input extends InputType>(tool: Tool<Input>): Tool<Input> { return tool; }