Skip to main content
Glama

get_javascript_errors

Retrieve captured JavaScript errors from Firefox tabs using the Firefox MCP Server. Specify tab ID, timeframe, and limit to analyze debugging or automation issues in browser sessions.

Instructions

Get captured JavaScript errors

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
sinceNo
tabIdNo

Implementation Reference

  • The core handler function for the 'get_javascript_errors' tool. Retrieves JavaScript errors from the tab's debug buffer, applies optional filters (since timestamp, limit), and returns formatted JSON output.
    async getJavaScriptErrors(args = {}) {
      const { tabId, since, limit = 20 } = args;
      const effectiveTabId = tabId || this.activeTabId;
      
      if (!effectiveTabId || !this.jsErrors.has(effectiveTabId)) {
        return { content: [{ type: 'text', text: 'No JavaScript errors captured for this tab' }] };
      }
    
      let errors = this.jsErrors.get(effectiveTabId);
      
      if (since) {
        errors = errors.filter(error => error.timestamp >= since);
      }
      
      errors = errors.slice(-limit);
    
      return {
        content: [{
          type: 'text',
          text: `JavaScript Errors (${errors.length}):\n` + JSON.stringify(errors, null, 2)
        }]
      };
    }
  • Input schema definition for the tool, specifying parameters: tabId (string), since (number timestamp), limit (number, default 20).
    {
      name: 'get_javascript_errors',
      description: 'Get captured JavaScript errors',
      inputSchema: {
        type: 'object',
        properties: {
          tabId: { type: 'string' },
          since: { type: 'number' },
          limit: { type: 'number', default: 20 }
        }
      }
  • Registration in the tool dispatch switch statement within CallToolRequestSchema handler, routing calls to the getJavaScriptErrors method.
    case 'get_javascript_errors':
      return await this.getJavaScriptErrors(args);
  • Helper: Playwright page.on('pageerror') listener that captures JavaScript errors and stores them in the tab-specific jsErrors Map for later retrieval.
    page.on('pageerror', (error) => {
      const errors = this.jsErrors.get(tabId) || [];
      errors.push({
        message: error.message,
        stack: error.stack,
        timestamp: Date.now()
      });
      this.jsErrors.set(tabId, errors);
    });
  • Helper: Initialization of empty jsErrors array for new tabs in initDebugBuffers method.
    this.jsErrors.set(tabId, []);
    this.networkActivity.set(tabId, []);
    this.wsMessages.set(tabId, []);
    this.performanceMetrics.set(tabId, { startTime: Date.now(), metrics: [] });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves errors but doesn't explain what 'captured' means, whether it requires prior setup (e.g., monitoring), if it's read-only or has side effects, or details on error format/limitations. This leaves critical behavioral traits unspecified for a tool with potential dependencies.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to parse quickly, though this brevity contributes to gaps in other dimensions.

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

Completeness2/5

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

Given the tool's complexity (retrieving dynamic error data with 3 parameters), lack of annotations, 0% schema coverage, and no output schema, the description is inadequate. It doesn't cover parameter meanings, behavioral context, or output expectations, leaving the agent with insufficient information for reliable use.

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

Parameters2/5

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

The schema has 0% description coverage, so parameters 'limit', 'since', and 'tabId' are undocumented in the schema. The description adds no information about these parameters—it doesn't mention filtering by time, tab, or pagination, failing to compensate for the schema's lack of documentation.

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

Purpose3/5

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

The description 'Get captured JavaScript errors' clearly states the verb ('Get') and resource ('captured JavaScript errors'), making the basic purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'get_console_logs' or 'get_all_debug_activity' that might also retrieve error-related information, leaving the scope ambiguous.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_console_logs' or 'get_all_debug_activity'. It doesn't mention prerequisites, context (e.g., after 'start_monitoring'), or exclusions, leaving the agent to infer usage based on the name alone.

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

Related 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/JediLuke/firefox-mcp-server'

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