Skip to main content
Glama

go_history

Idempotent

Navigate browser history back or forward to inspect previous or next pages. Returns current URL, title, and notifies if console errors occur after navigation.

Instructions

Navigate browser history (back/forward). Returns: 'Navigated in browser history', a quick network-idle note if available, 'URL: ', and 'Title: ' when set. If console errors occur after the navigation, returns an error like 'Console error after history navigation: ' including Title when available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesHistory direction to navigate

Implementation Reference

  • GoHistoryTool class — the main handler for the 'go_history' tool. Extends BrowserToolBase, defines getMetadata (name, description, inputSchema with 'direction' enum) and execute() which performs page.goBack() or page.goForward(), checks console errors, and reports URL/title.
    export class GoHistoryTool extends BrowserToolBase {
      static getMetadata(sessionConfig?: SessionConfig): ToolMetadata {
        return {
          name: 'go_history',
          description: "Navigate browser history (back/forward). Returns: 'Navigated <direction> in browser history', a quick network-idle note if available, 'URL: <current>', and 'Title: <current>' when set. If console errors occur after the navigation, returns an error like 'Console error after history navigation: <message>' including Title when available.",
          annotations: ANNOTATIONS.navigation,
          inputSchema: {
            type: 'object',
            properties: {
              direction: {
                type: 'string',
                description: "History direction to navigate",
                enum: ['back', 'forward']
              },
            },
            required: ['direction'],
          },
        };
      }
    
      async execute(args: any, context: ToolContext): Promise<ToolResponse> {
        this.recordNavigation();
        return this.safeExecute(context, async (page) => {
          const dir: Direction = args.direction === 'forward' ? 'forward' : 'back';
    
          // Capture initial state
          let initialUrl = '';
          let initialTitle = '';
          try { initialUrl = page.url(); } catch {}
          try { initialTitle = await page.title(); } catch {}
    
          // Perform history navigation
          if (dir === 'back') {
            await page.goBack();
          } else {
            await page.goForward();
          }
    
          const verb = dir === 'back' ? 'back' : 'forward';
          const lines: string[] = [`Navigated ${verb} in browser history`];
    
          // Allow network to settle briefly first (best-effort)
          try {
            const note = await quickNetworkIdleNote(page);
            if (note) lines.push(note);
          } catch {}
    
          // After the brief wait, surface console errors since navigation
          try {
            const errs = await gatherConsoleErrorsSince('navigation');
            if (errs.length > 0) {
              let titleInfo = '';
              try {
                const t = await page.title();
                if (t) titleInfo = `\nTitle: ${t}`;
              } catch {}
              return createErrorResponse(`Console error after history navigation: ${errs[0]}${titleInfo}`);
            }
          } catch {}
    
          // Report new URL and Title explicitly
          try {
            const newUrl = page.url();
            lines.push(`URL: ${newUrl}`);
          } catch {}
          try {
            const newTitle = await page.title();
            if (newTitle) lines.push(`Title: ${newTitle}`);
          } catch {}
    
          return createSuccessResponse(lines);
        });
      }
    }
  • Input schema for go_history: requires 'direction' (string, enum: ['back', 'forward']).
    inputSchema: {
      type: 'object',
      properties: {
        direction: {
          type: 'string',
          description: "History direction to navigate",
          enum: ['back', 'forward']
        },
      },
      required: ['direction'],
    },
  • GoHistoryTool is registered in the BROWSER_TOOL_CLASSES array at line 56, alongside other navigation tools.
      GoHistoryTool,
      ScrollToElementTool,
      ScrollByTool,
    
      // Lifecycle (2)
      CloseTool,
      SetColorSchemeTool,
    
      // Interaction (7)
      ClickTool,
      FillTool,
      SelectTool,
      HoverTool,
      UploadFileTool,
      DragTool,
      PressKeyTool,
    
      // Content (3)
      ScreenshotTool,
      GetTextTool,
      GetHtmlTool,
    
      // Inspection (10)
      InspectDomTool,
      GetTestIdsTool,
      QuerySelectorTool,
      FindByTextTool,
      CheckVisibilityTool,
      CompareElementAlignmentTool,
      InspectAncestorsTool,
      ElementExistsTool,
      MeasureElementTool,
      GetComputedStylesTool,
    
      // Evaluation (1)
      EvaluateTool,
    
      // Console (2)
      GetConsoleLogsTool,
      ClearConsoleLogsTool,
    
      // Network (2)
      ListNetworkRequestsTool,
      GetRequestDetailsTool,
    
      // Waiting (2)
      WaitForElementTool,
      WaitForNetworkIdleTool,
    ];
  • GoHistoryTool is imported from './navigation/history.js' in the registration file.
    import { GoHistoryTool } from './navigation/history.js';
  • Helper reference: evaluate tool suggests using 'go_history' when code patterns like window.location or history.pushState are detected.
      suggestions.push({ key: 'nav', line: '🌐 navigate / go_history — vs window.location / history.pushState' });
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Explicitly describes return values including a network-idle note and console error handling, which adds context beyond annotations. However, it does not mention behavior when history stack is empty or after multiple idempotent calls (consistent with annotations but still a gap).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise, front-loaded with purpose, and includes essential return details. Every sentence adds value, though the listing of return fields could be more compact.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple 1-parameter tool with no output schema. Missing edge cases like empty history or unsupported direction (though schema validation covers it). Sompleteness is acceptable but not exhaustive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and includes an enum, so the schema already fully defines the direction. Description adds no extra meaning beyond repeating 'back/forward'. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it navigates browser history with 'back' or 'forward', and the name is self-explanatory. However, it does not differentiate from sibling tools like 'navigate' or 'scroll_by', leaving ambiguity about when to use this specific tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool instead of 'navigate' (which goes to URLs) or 'scroll_by'. Does not specify conditions like when history is empty or edge cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/antonzherdev/mcp-web-inspector'

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