performance_stop_trace
Stop active performance trace recording in Chrome DevTools to analyze page performance metrics and identify optimization opportunities.
Instructions
Stops the active performance trace recording on the selected page.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/performance.ts:104-120 (registration)Registration of the 'performance_stop_trace' tool. Includes the name, description, empty schema, annotations, and handler function that delegates to the helper.export const stopTrace = defineTool({ name: 'performance_stop_trace', description: 'Stops the active performance trace recording on the selected page.', annotations: { category: ToolCategories.PERFORMANCE, readOnlyHint: true, }, schema: {}, handler: async (_request, response, context) => { if (!context.isRunningPerformanceTrace()) { return; } const page = context.getSelectedPage(); await stopTracingAndAppendOutput(page, response, context); }, });
- src/tools/performance.ts:159-188 (helper)Core helper function that stops the performance tracing on the page, parses the trace buffer, stores the result if successful, appends summary or error to response, and resets the running trace flag.async function stopTracingAndAppendOutput( page: Page, response: Response, context: Context, ): Promise<void> { try { const traceEventsBuffer = await page.tracing.stop(); const result = await parseRawTraceBuffer(traceEventsBuffer); response.appendResponseLine('The performance trace has been stopped.'); if (traceResultIsSuccess(result)) { context.storeTraceRecording(result); const traceSummaryText = getTraceSummary(result); response.appendResponseLine(traceSummaryText); } else { response.appendResponseLine( 'There was an unexpected error parsing the trace:', ); response.appendResponseLine(result.error); } } catch (e) { const errorText = e instanceof Error ? e.message : JSON.stringify(e); logger(`Error stopping performance trace: ${errorText}`); response.appendResponseLine( 'An error occurred generating the response for this trace:', ); response.appendResponseLine(errorText); } finally { context.setIsRunningPerformanceTrace(false); } }
- src/tools/performance.ts:112-112 (schema)Empty schema for performance_stop_trace tool (no input parameters).schema: {},