run_performance_audit
Analyze web page performance metrics to identify optimization opportunities and improve loading speed on ARM64 devices.
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 main handler function that performs the performance audit. It ensures Chromium is running, evaluates JavaScript on the page to extract performance metrics (DOM content loaded time, load complete time, 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:381-382 (registration)In the CallToolRequest handler switch statement, routes calls to 'run_performance_audit' to the runPerformanceAudit method.case 'run_performance_audit': return await this.runPerformanceAudit();
- index.js:288-294 (registration)Registers the tool in the ListTools response with 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:290-293 (schema)Defines the input schema for the tool: an empty object (no required parameters).inputSchema: { type: 'object', properties: {}, },