fix(mcp): report running daemon version#1358
Open
Conversation
PR Build Metrics✅ All clear — no issues detected
Binary Size
Dependency ChangesNo dependency changes. govulncheck OutputBuild Info
🤖 Updated on each push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The MCP
litestream_versiontool now returns the daemon's in-processVersionvalue instead of launching whicheverlitestreamexecutable appears first on$PATH. The response preserves the existing newline formatting, and the tool description now identifies the running daemon as the version source.A regression test removes
litestreamfrom$PATH, resolves a distinct in-process version through the machinery added by #1338, and verifies that the MCP response still reports it.Scope: This changes only
litestream_version; other MCP tools that intentionally invoke CLI operations remain unchanged.This PR is stacked on #1338 and uses its version-resolution machinery.
Motivation and Context
The previous handler called
exec.CommandContext(ctx, "litestream", "version"), so its answer described the PATH binary rather than the daemon serving the MCP request. If no PATH binary existed, the regression test failed with:Returning the already-resolved process value makes the MCP result match the running daemon regardless of how it was launched or what is installed on
$PATH.Fixes #1353
How Has This Been Tested?
go test ./cmd/litestream -run '^TestVersionTool$' -count=1 -vfailed before the production change and passed afterward.go test ./... -count=1go test -race ./... -count=1go vet ./...pre-commit run --all-filesgo build -o bin/litestream ./cmd/litestreamTypes of changes
Checklist
go fmt,go vet)go test ./...)