diff options
| author | adamdottv <[email protected]> | 2025-05-02 13:59:25 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-05-02 15:24:47 -0500 |
| commit | 406ccf9b878d1d9bd0c9bf8ed3432fe6f156fee3 (patch) | |
| tree | 568a88e85b0d2d2b92c14186523967a3eb63c82f | |
| parent | f90d6238ed7bb3620623df37812d479522145fad (diff) | |
| download | opencode-406ccf9b878d1d9bd0c9bf8ed3432fe6f156fee3.tar.gz opencode-406ccf9b878d1d9bd0c9bf8ed3432fe6f156fee3.zip | |
fix: diagnostics tool init
| -rw-r--r-- | internal/llm/agent/tools.go | 8 | ||||
| -rw-r--r-- | internal/llm/tools/diagnostics.go | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/internal/llm/agent/tools.go b/internal/llm/agent/tools.go index e6b0119ae..43e5978e4 100644 --- a/internal/llm/agent/tools.go +++ b/internal/llm/agent/tools.go @@ -20,9 +20,11 @@ func CoderAgentTools( ) []tools.BaseTool { ctx := context.Background() otherTools := GetMcpTools(ctx, permissions) - if len(lspClients) > 0 { - otherTools = append(otherTools, tools.NewDiagnosticsTool(lspClients)) - } + + // Always add the Diagnostics tool even if lspClients is empty + // The tool will handle the case when no clients are available + otherTools = append(otherTools, tools.NewDiagnosticsTool(lspClients)) + return append( []tools.BaseTool{ tools.NewBashTool(permissions), diff --git a/internal/llm/tools/diagnostics.go b/internal/llm/tools/diagnostics.go index b4c5941c4..5355c164b 100644 --- a/internal/llm/tools/diagnostics.go +++ b/internal/llm/tools/diagnostics.go @@ -74,7 +74,8 @@ func (b *diagnosticsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, lsps := b.lspClients if len(lsps) == 0 { - return NewTextErrorResponse("no LSP clients available"), nil + // Return a more helpful message when LSP clients aren't ready yet + return NewTextResponse("\n<diagnostic_summary>\nLSP clients are still initializing. Diagnostics will be available once they're ready.\n</diagnostic_summary>\n"), nil } if params.FilePath != "" { |
