navigate_page_history
Navigate back or forward through browser history to automate testing, debugging, or content analysis workflows in Chrome DevTools.
Instructions
Navigates the currently selected page.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"navigate": "<navigate>"
},
"name": "navigate_page_history"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| navigate | Yes | Whether to navigate back or navigate forward in the selected pages history | |
| timeout | No | Maximum wait time in milliseconds. If set to 0, the default timeout will be used. |
Implementation Reference
- src/tools/pages.ts:140-159 (handler)The handler function that performs back or forward navigation on the currently selected page's history using Playwright's goBack/goForward methods, with timeout and error handling.
handler: async (request, response, context) => { const page = context.getSelectedPage(); const options = { timeout: request.params.timeout, }; try { if (request.params.navigate === 'back') { await page.goBack(options); } else { await page.goForward(options); } } catch (error) { response.appendResponseLine( `Unable to navigate ${request.params.navigate} in currently selected page. ${error.message}`, ); } response.setIncludePages(true); }, - src/tools/pages.ts:132-139 (schema)Input schema using Zod: 'navigate' enum ('back' or 'forward') and timeout from timeoutSchema.
schema: { navigate: z .enum(['back', 'forward']) .describe( 'Whether to navigate back or navigate forward in the selected pages history', ), ...timeoutSchema, }, - src/tools/pages.ts:125-160 (registration)Full tool definition and export using defineTool, including name 'navigate_page_history', description, annotations, schema, and handler.
export const navigatePageHistory = defineTool({ name: 'navigate_page_history', description: `Navigates the currently selected page.`, annotations: { category: ToolCategories.NAVIGATION_AUTOMATION, readOnlyHint: false, }, schema: { navigate: z .enum(['back', 'forward']) .describe( 'Whether to navigate back or navigate forward in the selected pages history', ), ...timeoutSchema, }, handler: async (request, response, context) => { const page = context.getSelectedPage(); const options = { timeout: request.params.timeout, }; try { if (request.params.navigate === 'back') { await page.goBack(options); } else { await page.goForward(options); } } catch (error) { response.appendResponseLine( `Unable to navigate ${request.params.navigate} in currently selected page. ${error.message}`, ); } response.setIncludePages(true); }, });