Skip to content

[bug] Tools list implementation is blocked #68

Description

@blak-Dev

Tool version

Release 0.8.0

.NET SDK version

10.0.300

Operating system

Windows

MCP client

Antigravity IDE

What happened?

With a completely fresh start (no .sourcegraph directory), when the server starts:

It creates a new empty DB at the default location
It starts in "fresh" state - no degraded state
It should respond to tools/list immediately
But it's still only returning the initialize response.

Wait - maybe the issue is something else entirely. Maybe the server's tools/list implementation is blocked because it's waiting for the background indexer to start before it will serve tools.

Actually, that's it! Even with --no-embeddings and --no-history, the indexer still runs to build the initial index. With 1406 C# files and a completely fresh state, the indexer needs to process everything from scratch, which could take several minutes. The tools/list call is probably blocked waiting for that initial indexing to complete.

So when Antigravity starts the server, it indexes all files first before serving requests. Our probes kill the server before indexing finishes, so tools/list never gets a response. The solution is either waiting for full indexing to complete, or running index first to populate the database so the server only needs to check for changes rather than re-index everything.

But wait—I'm second-guessing myself. Why would tools/list actually block on indexing? Tool registration should happen when the server starts, independent of the index. Unless the server is deliberately designed to not expose tools until there's an indexed database to search against.

Looking at the actual server behavior, it seems like both fresh and degraded states block tools/list until background work completes. So the real issue is that we need either a fully indexed database ready to go, or we have to let the indexing finish before we can list tools.

What did you expect to happen?

1- MCP on start ,must allow for listing tools , not to block it ,2- Serve must have an option for read only operation , not to index any thing

Steps to reproduce

$init = '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"probe","version":"1.0"}}}'
$initd = '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}'
$list = '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = 'C:\Users***.dotnet\tools\sourcegraph-mcp.exe'

No --solution: no indexer starts, just tools registration

$psi.Arguments = 'serve --no-model-download --no-embeddings --no-history'
$psi.RedirectStandardInput = $true
$psi.RedirectStandardOutput = $true
$psi.RedirectStandardError = $true
$psi.UseShellExecute = $false
$psi.CreateNoWindow = $true
$p = [System.Diagnostics.Process]::Start($psi)
$w = $p.StandardInput

Start-Sleep -Milliseconds 600
$w.WriteLine($init); $w.Flush()
$lines = [System.Collections.Generic.List[string]]::new()
$deadline = [DateTime]::UtcNow.AddSeconds(12)
while ([DateTime]::UtcNow -lt $deadline) {
if ($p.StandardOutput.Peek() -ge 0) {
$line = $p.StandardOutput.ReadLine(); $lines.Add($line)
$obj = $line | ConvertFrom-Json -EA SilentlyContinue
if ($obj -and $obj.id -eq 1) { "Got init id=1"; break }
} else { [System.Threading.Thread]::Sleep(30) }
}
$w.WriteLine($initd); $w.Flush()
Start-Sleep -Milliseconds 300
$w.WriteLine($list); $w.Flush()
$deadline2 = [DateTime]::UtcNow.AddSeconds(15)
while ([DateTime]::UtcNow -lt $deadline2) {
if ($p.StandardOutput.Peek() -ge 0) {
$line = $p.StandardOutput.ReadLine(); $lines.Add($line)
$obj = $line | ConvertFrom-Json -EA SilentlyContinue
if ($obj -and $obj.id -eq 2) { "Got tools/list id=2"; break }
} else { [System.Threading.Thread]::Sleep(30) }
}
try { $p.Kill() } catch {}

"Total lines: $($lines.Count)"
foreach ($line in $lines) {
$obj = $line | ConvertFrom-Json -EA SilentlyContinue; if (-not $obj) { continue }
"=== id=$($obj.id) ==="
if ($obj.result.tools) { $obj.result.tools | ForEach-Object { " [$($.name)] $($.description -split '\n' | Select-Object -First 1)" } }
else { " keys=" + (($obj.result | Get-Member -MemberType NoteProperty -EA SilentlyContinue).Name -join ', ') }
}

Logs / usage.jsonl excerpt

Pre-submit checks

  • I searched existing issues and didn't find a duplicate.
  • This is not a security issue (those go through SECURITY.md).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions