Skip to main content
Glama

run_performance_audit

Analyze website performance using Lighthouse audits to identify optimization opportunities and improve loading speed.

Instructions

Run Lighthouse performance audit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
configNo

Implementation Reference

  • Core handler implementation that performs HTTP POST to Browserless '/performance' endpoint to execute the Lighthouse performance audit.
    async runPerformanceAudit(request: PerformanceRequest): Promise<BrowserlessResponse<PerformanceResponse>> {
      try {
        const response: AxiosResponse<PerformanceResponse> = await this.httpClient.post('/performance', request);
    
        return {
          success: true,
          data: response.data,
        };
      } catch (error) {
        return this.handleError(error);
      }
    }
  • MCP server-side tool handler for 'run_performance_audit' that delegates to BrowserlessClient and formats the MCP response.
    case 'run_performance_audit': {
      if (!args) throw new Error('Arguments are required');
      const result = await this.client!.runPerformanceAudit(args as any);
      if (result.success && result.data) {
        return {
          content: [
            {
              type: 'text',
              text: 'Performance audit completed successfully.',
            },
            {
              type: 'text',
              text: JSON.stringify(result.data, null, 2),
            },
          ],
        };
      } else {
        throw new Error(result.error || 'Failed to run performance audit');
      }
    }
  • Input schema definition for the 'run_performance_audit' tool, including required 'url' and optional 'config'.
    {
      name: 'run_performance_audit',
      description: 'Run Lighthouse performance audit',
      inputSchema: {
        type: 'object',
        properties: {
          url: { type: 'string' },
          config: {
            type: 'object',
            properties: {
              extends: { type: 'string' },
              settings: { type: 'object' },
            },
          },
        },
        required: ['url'],
      },
    },
  • Zod schema and TypeScript type definition for PerformanceRequest used in the client implementation.
    export const PerformanceRequestSchema = z.object({
      url: z.string(),
      config: z.object({
        extends: z.string().optional(),
        settings: z.record(z.any()).optional(),
      }).optional(),
    });
    
    export type PerformanceRequest = z.infer<typeof PerformanceRequestSchema>;

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/Lizzard-Solutions/browserless-mcp'

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