diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a813bc..5595e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.10.22 (Preview) + +### Fixed +- **Multi-binlog timeline/tree crash** — fixed "requires explicit binlog_file" errors when the MCP server was started with multiple binlogs. The sidebar, tree prefetch, diagnostics, and timeline now correctly inject `binlog_file` even when the sidebar and MCP server binlog lists are out of sync. + ## 0.10.21 (Preview) ### Changed diff --git a/package.json b/package.json index 72f377d..f11cbba 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "binlog-analyzer", "displayName": "MSBuild Binlog Analyzer", "description": "Analyze MSBuild binary logs with Copilot Chat and MCP tools", - "version": "0.10.21", + "version": "0.10.22", "preview": true, "publisher": "dotutils", "license": "MIT", diff --git a/src/binlogTreeView.ts b/src/binlogTreeView.ts index 55c598c..4d8e18e 100644 --- a/src/binlogTreeView.ts +++ b/src/binlogTreeView.ts @@ -209,7 +209,7 @@ export class BinlogTreeDataProvider implements vscode.TreeDataProvider { try { - const result = await client.callTool(c.tool, c.args); + const result = await this.mcpCall(c.tool, c.args); const data = this.tryParseJson(result.text); if (c.cache === 'projects') { @@ -1668,7 +1668,8 @@ export class BinlogTreeDataProvider implements vscode.TreeDataProvider = {}): Promise<{ text: string }> { if (!this.mcpClient) { throw new Error('MCP server not connected'); } if (!args.binlog_file && this.binlogPaths.length >= 1) { - args.binlog_file = this.activeBinlogPath || this.binlogPaths[0]; + const copy = { ...args, binlog_file: this.activeBinlogPath || this.binlogPaths[0] }; + return this.mcpClient.callTool(tool, copy); } return this.mcpClient.callTool(tool, args); } diff --git a/src/diagnostics.ts b/src/diagnostics.ts index fb83b7b..f91bfde 100644 --- a/src/diagnostics.ts +++ b/src/diagnostics.ts @@ -53,7 +53,11 @@ export class BinlogDiagnosticsProvider implements vscode.Disposable { if (!this.mcpClient) { return; } try { - const result = await this.mcpClient.callTool('get_diagnostics'); + const args: Record = {}; + if (this.mcpClient.loadedBinlogs.length > 1) { + args.binlog_file = this.mcpClient.loadedBinlogs[0]; + } + const result = await this.mcpClient.callTool('get_diagnostics', args); const data = JSON.parse(result.text); const diagnostics = this.parseMcpDiagnostics(data); this.cachedDiagnostics = diagnostics; diff --git a/src/extension.ts b/src/extension.ts index ee478b3..02eb117 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -48,7 +48,10 @@ function escapeHtml(s: string): string { */ function callMcpTool(tool: string, args: Record = {}): Promise<{ text: string }> { if (!mcpClient) { throw new Error('MCP server not connected'); } - if (!args.binlog_file && allBinlogPaths.length > 1) { + // Always inject binlog_file when the MCP server was started with multiple + // binlogs — even if the user removed one from the sidebar, the server + // still requires an explicit path. + if (!args.binlog_file && (allBinlogPaths.length > 1 || (mcpClient.loadedBinlogs && mcpClient.loadedBinlogs.length > 1))) { const copy = { ...args, binlog_file: currentBinlogPath || allBinlogPaths[0] }; return mcpClient.callTool(tool, copy); }