diagnostics
Retrieve browser cache, errors, and performance metrics to troubleshoot issues with Strudel music pattern generation and playback.
Instructions
Get detailed browser diagnostics including cache, errors, and performance
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/tools/diagnostics.ts:78-86 (handler)Handler for the 'diagnostics' tool. Checks initialization, then delegates to ctx.controller.getDiagnostics().
case 'diagnostics': { if (!ctx.isInitialized()) { return { initialized: false, message: 'Browser not initialized. Run init first for full diagnostics.', }; } return await ctx.controller.getDiagnostics(); } - Schema definition for the 'diagnostics' tool: name, description, and empty inputSchema (no parameters).
{ name: 'diagnostics', description: 'Get detailed browser diagnostics including cache, errors, and performance', inputSchema: { type: 'object', properties: {} }, - src/types/AudioAnalysis.ts:86-96 (schema)BrowserDiagnostics interface: browserConnected, pageLoaded, editorReady, audioConnected, cacheStatus, errorStats.
export interface BrowserDiagnostics { browserConnected: boolean; pageLoaded: boolean; editorReady: boolean; audioConnected: boolean; cacheStatus: { hasCache: boolean; cacheAge: number; }; errorStats: Record<string, ErrorStats>; } - src/StrudelController.ts:766-796 (helper)getDiagnostics() on StrudelController: gathers browser/page state, editor readiness, audio connection, cache info, and error stats.
async getDiagnostics(): Promise<BrowserDiagnostics> { const diagnostics: BrowserDiagnostics = { browserConnected: this.browser !== null, pageLoaded: this._page !== null, editorReady: false, audioConnected: false, cacheStatus: { hasCache: this.editorCache.length > 0, cacheAge: this.cacheTimestamp > 0 ? Date.now() - this.cacheTimestamp : 0 }, errorStats: this.errorRecovery.getErrorStats() }; if (this._page) { try { // Check that strudelMirror API is available diagnostics.editorReady = await this._page.evaluate(() => { const sm = (window as any).strudelMirror; return sm?.editor?.dispatch !== undefined; }); diagnostics.audioConnected = await this._page.evaluate(() => { return (window as any).strudelAudioAnalyzer?.isConnected || false; }); } catch (error) { this.logger.warn('Failed to get diagnostics', error); } } return diagnostics; } - src/server/server.ts:131-132 (registration)Registration: diagnosticsModule.tools are spread into the server's tool list.
// Performance, diagnostics, screenshots — extracted to src/server/tools/diagnostics.ts (#104) ...diagnosticsModule.tools,