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 for the 'run_performance_audit' tool. It ensures the Chromium instance is running, executes a JavaScript snippet via CDP to gather performance metrics (domContentLoaded, loadComplete, firstPaint, resourceCount, memoryUsage), parses the result, and returns formatted text output.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:287-294 (registration)Tool registration in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (empty object properties).{ name: 'run_performance_audit', description: 'Run a performance audit on the current page', inputSchema: { type: 'object', properties: {}, }, },
- index.js:381-382 (registration)Dispatch case in the CallToolRequestSchema handler's switch statement that routes calls to the runPerformanceAudit method.case 'run_performance_audit': return await this.runPerformanceAudit();
- index.js:290-293 (schema)Input schema definition for the tool (accepts no parameters).inputSchema: { type: 'object', properties: {}, },