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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| since | No | ||
| tabId | No |
Implementation Reference
- index-multi-debug.js:693-715 (handler)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) }] }; }
- index-multi-debug.js:288-298 (schema)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 } } }
- index-multi-debug.js:441-442 (registration)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);
- index-multi-debug.js:502-510 (helper)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); });
- index-multi-debug.js:470-473 (helper)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: [] });