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: [] });

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