Skip to main content
Glama

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
navigateYesWhether to navigate back or navigate forward in the selected pages history
timeoutNoMaximum wait time in milliseconds. If set to 0, the default timeout will be used.

Implementation Reference

  • 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); },
  • 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, },
  • 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); }, });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SHAY5555-gif/chrome-devtools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server