get_metrics
Retrieve browser performance metrics and audit data for web pages to analyze loading times, resource usage, and optimization opportunities.
Instructions
Get metrics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:592-610 (handler)MCP tool handler for 'get_metrics': calls client.getMetrics() and returns the metrics data as formatted text content.case 'get_metrics': { const result = await this.client!.getMetrics(); if (result.success && result.data) { return { content: [ { type: 'text', text: 'Current metrics:', }, { type: 'text', text: JSON.stringify(result.data, null, 2), }, ], }; } else { throw new Error(result.error || 'Failed to get metrics'); } }
- src/index.ts:267-274 (registration)Registers the 'get_metrics' tool in the ListTools response, including its name, description, and empty input schema.{ name: 'get_metrics', description: 'Get metrics', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:270-273 (schema)Defines the input schema for the 'get_metrics' tool (empty object, no parameters required).inputSchema: { type: 'object', properties: {}, },
- src/client.ts:323-334 (helper)Helper method in BrowserlessClient that fetches metrics via HTTP GET to '/metrics' endpoint and handles errors.async getMetrics(): Promise<BrowserlessResponse<any>> { try { const response: AxiosResponse<any> = await this.httpClient.get('/metrics'); return { success: true, data: response.data, }; } catch (error) { return this.handleError(error); } }