run_performance_audit
Execute Lighthouse performance audits on websites to analyze and optimize loading speed, responsiveness, and overall user experience using Browserless MCP Server.
Instructions
Run Lighthouse performance audit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | No | ||
| url | Yes |
Implementation Reference
- src/index.ts:172-189 (registration)Tool registration in the MCP server's ListTools response, defining the tool name, description, and input schema.{ 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/index.ts:437-456 (handler)MCP server handler for callToolRequest, dispatching to BrowserlessClient and formatting 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/client.ts:185-196 (handler)Core tool handler in BrowserlessClient: sends POST request to Browserless server /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/types.ts:200-208 (schema)Zod schema and TypeScript type definition for PerformanceRequest input.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>;
- src/types.ts:293-296 (schema)TypeScript interface for PerformanceResponse output.export interface PerformanceResponse { lighthouse: any; metrics: any; }