Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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();
  • Input schema definition for the tool (accepts no parameters).
    inputSchema: {
      type: 'object',
      properties: {},
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nfodor/claude-arm64-browser'

If you have feedback or need assistance with the MCP directory API, please join our Discord server