get_performance_metrics
Retrieve performance metrics like timing and memory usage for a specific Firefox browser tab using Playwright automation on the Firefox MCP Server.
Instructions
Get performance metrics (timing, memory usage)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | No |
Implementation Reference
- index-multi-debug.js:781-813 (handler)The handler function that executes the get_performance_metrics tool. It retrieves performance timing, paint events, and memory usage from the browser page using Playwright's evaluate method on the Performance API.async getPerformanceMetrics(args = {}) { const { tabId } = args; const effectiveTabId = tabId || this.activeTabId; const page = this.getPage(effectiveTabId); // Get performance metrics from browser const metrics = await page.evaluate(() => { const nav = performance.getEntriesByType('navigation')[0]; const paint = performance.getEntriesByType('paint'); return { navigation: nav ? { domContentLoaded: nav.domContentLoadedEventEnd - nav.domContentLoadedEventStart, loadComplete: nav.loadEventEnd - nav.loadEventStart, totalTime: nav.loadEventEnd - nav.fetchStart } : null, paint: paint.map(p => ({ name: p.name, startTime: p.startTime })), memory: performance.memory ? { usedJSHeapSize: performance.memory.usedJSHeapSize, totalJSHeapSize: performance.memory.totalJSHeapSize, jsHeapSizeLimit: performance.memory.jsHeapSizeLimit } : null, timestamp: Date.now() }; }); return { content: [{ type: 'text', text: `Performance Metrics:\n` + JSON.stringify(metrics, null, 2) }] }; }
- index-multi-debug.js:325-334 (registration)Registration of the get_performance_metrics tool in the ListToolsRequestSchema handler, including name, description, and input schema specifying optional tabId.{ name: 'get_performance_metrics', description: 'Get performance metrics (timing, memory usage)', inputSchema: { type: 'object', properties: { tabId: { type: 'string' } } } },
- index-multi-debug.js:325-334 (schema)Input schema definition for the get_performance_metrics tool, defining optional tabId parameter.{ name: 'get_performance_metrics', description: 'Get performance metrics (timing, memory usage)', inputSchema: { type: 'object', properties: { tabId: { type: 'string' } } } },