Skip to content

fix(mcp): correct optional parameter handling#1376

Open
corylanou wants to merge 4 commits into
mainfrom
issue-1366-fix-mcp-correct-optional-parameter-handling-and-tool-descrip
Open

fix(mcp): correct optional parameter handling#1376
corylanou wants to merge 4 commits into
mainfrom
issue-1366-fix-mcp-correct-optional-parameter-handling-and-tool-descrip

Conversation

@corylanou

@corylanou corylanou commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Correct MCP command construction so optional values use the SDK accessors, empty config paths are omitted, and restore parameters are self-describing. Restore continues accepting the legacy o alias while publishing output, and boolean options now map to valid CLI flags.

In scope:

  • Optional MCP string and boolean argument handling
  • Empty config omission for every config-aware MCP tool
  • Restore output and conditional flag schema descriptions
  • Handler-level regression coverage for exact CLI arguments and tool schema

Not in scope:

Motivation and Context

Before this change, the regression tests showed databases, info, status, and reset executing with an empty -config value. Restore also ignored the self-describing output argument and emitted boolean values as separate positional arguments. The MCP schema exposed the CLI shorthand o and described conditional behavior as returning an exit code rather than explaining the tool behavior.

Fixes #1366

How Has This Been Tested?

go test ./cmd/litestream -run 'TestMCPToolsOmitEmptyConfig|TestRestoreTool' -v -count=1
go build ./...
go test ./... -count=1
go test -race ./... -count=1
go vet ./...
pre-commit run --all-files
golangci-lint run --new-from-rev=origin/main
GOTOOLCHAIN=go1.25.12 govulncheck ./...

Changed production code is in package main, so the workflow coverage gate is informational; cmd/litestream/mcp.go measured 63.1% statement coverage.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (would cause existing functionality to not work as expected)

Checklist

  • My code follows the code style of this project (go fmt, go vet)
  • I have tested my changes (go test ./...)
  • I have updated the documentation accordingly (if needed)

Closes #1366

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

PR Build Metrics

All clear — no issues detected

Check Status Summary
Binary size 36.98 MB (+8.0 KB / +0.02%)
Dependencies No changes
Vulnerabilities None detected
Go toolchain 1.25.12 (latest)
Module graph 1240 edges (0)

Binary Size

Size Change
Base (d26cb54) 36.98 MB
PR (8ac9831) 36.98 MB +8.0 KB (+0.02%)

Dependency Changes

No dependency changes.

govulncheck Output

=== Symbol Results ===

No vulnerabilities found.

Your code is affected by 0 vulnerabilities.
This scan also found 0 vulnerabilities in packages you import and 1
vulnerability in modules you require, but your code doesn't appear to call these
vulnerabilities.
Use '-show verbose' for more details.

Build Info

Metric Value
Build time 44s
Go version go1.25.12
Commit 8ac9831

History (3 previous)

Commit Updated Status Summary
5a0255c 2026-07-18 22:49 UTC 36.98 MB (+8.0 KB / +0.02%)
3ced716 2026-07-18 17:32 UTC 36.98 MB (+4.0 KB / +0.01%)
2bd3a13 2026-07-16 19:58 UTC 36.98 MB (+4.0 KB / +0.01%)

🤖 Updated on each push.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(mcp): correct optional-parameter handling and tool descriptions

1 participant