Skip to main content
Glama

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
NameRequiredDescriptionDefault
tabIdNo

Implementation Reference

  • 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)
        }]
      };
    }
  • 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' }
        }
      }
    },
  • 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' }
        }
      }
    },

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/JediLuke/firefox-mcp-server'

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