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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| config | No |
Implementation Reference
- src/client.ts:185-196 (handler)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); } }
- src/index.ts:437-456 (handler)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'); } }
- src/index.ts:172-189 (schema)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'], }, },
- src/types.ts:200-208 (schema)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>;