run_performance_audit
Analyze page performance metrics on ARM64 devices using Chromium for browser automation and web testing. Assess navigation, rendering, and resource efficiency to optimize workflows.
Instructions
Run a performance audit on the current page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:876-904 (handler)The handler function for run_performance_audit. Ensures Chromium is running, evaluates JavaScript to gather performance metrics (DOM content loaded, load complete, first paint, resource count, memory usage), parses the results, and returns them as text content.async runPerformanceAudit() { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const perfData = performance.getEntriesByType('navigation')[0]; const timing = performance.timing; JSON.stringify({ domContentLoaded: perfData ? Math.round(perfData.domContentLoadedEventEnd - perfData.domContentLoadedEventStart) : 0, loadComplete: perfData ? Math.round(perfData.loadEventEnd - perfData.loadEventStart) : 0, firstPaint: timing ? timing.loadEventEnd - timing.navigationStart : 0, resourceCount: performance.getEntriesByType('resource').length, memoryUsage: performance.memory ? { used: Math.round(performance.memory.usedJSHeapSize / 1024 / 1024), total: Math.round(performance.memory.totalJSHeapSize / 1024 / 1024), limit: Math.round(performance.memory.jsHeapSizeLimit / 1024 / 1024) } : 'Not available' }); `, returnByValue: true }); const performanceMetrics = JSON.parse(result.result?.value || '{}'); return { content: [{ type: 'text', text: `Performance Audit Results:\\n${JSON.stringify(performanceMetrics, null, 2)}` }], }; }
- index.js:288-294 (registration)Tool registration in the ListTools response, defining the name, description, and input schema (empty object, no parameters required).name: 'run_performance_audit', description: 'Run a performance audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:381-382 (handler)Dispatch case in the CallToolRequest handler that routes the tool call to the runPerformanceAudit method.case 'run_performance_audit': return await this.runPerformanceAudit();
- index.js:290-293 (schema)Input schema definition for the tool, specifying an empty object (no input parameters).inputSchema: { type: 'object', properties: {}, },