Fix MCP null argument binding and culture-dependent history - #227
Merged
Mike Krüger (mkrueger) merged 4 commits intoOct 2, 2026
Merged
Conversation
Treat explicit JSON null option and parameter values as omitted before binding, so nullable value-typed options such as watch --interval no longer fail with "Invalid value". A null continuation token is still rejected because it signals an exhausted result set. Render echoed history values with the invariant culture so recorded command lines stay replayable, and make the echo MCP test independent of other tests that record the same history line. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mike Krüger (mkrueger)
requested review from
a team
and
a balanced review from Copilot
September 29, 2026 13:16
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated behavior and includes appropriate regression coverage and documentation.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes MCP null argument binding and culture-safe command history replay.
Changes:
- Treats explicit
nullarguments as omitted while preserving continuation-token validation. - Formats history values using invariant culture.
- Adds focused tests and MCP documentation.
| File | Description |
|---|---|
docs/mcp.md |
Documents null argument behavior. |
ToolOperations.cs |
Implements null omission and invariant formatting. |
ToolOperationsCallToolTests.cs |
Covers null binding, culture formatting, and history isolation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Vsevolod Kukol (sevoku)
approved these changes
Oct 2, 2026
Mike Krüger (mkrueger)
enabled auto-merge (squash)
October 2, 2026 10:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Vsevolod Kukol (sevoku)
approved these changes
Oct 2, 2026
Mike Krüger (mkrueger)
disabled auto-merge
October 2, 2026 11:27
Mike Krüger (mkrueger)
deleted the
dev/mkrueger/fix-mcp-argument-binding
branch
October 2, 2026 11:27
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.

Problem
nullarguments failed to bind. MCP clients often sendnullfor optional arguments, for examplewatchwith{"interval": null}.BindMemberunwrappedNullable<T>, andConvertJsonElementthen calledGetDouble()/GetInt32()/GetBoolean()on a JSONnull, so the call failed with "Invalid value ...".FormatOptionForHistory/FormatPositionalsForHistoryusedToString(). Onde-DE,watch --interval 1.5was recorded as--interval "1,5", so the recorded command line did not replay correctly.Changes
nullfor an option or parameter is treated as omitted. It is not bound, not echoed into history, and not counted as a supplied required parameter, so a required parameter passed asnullstill reports the existing missing-parameter error.continuationargument keeps rejectingnull, because anulltoken must not be sent back: it indicates exhaustion unlessresultIncompleteistrue, which indicates truncated results that cannot be resumed. Thermsafety optionspartition-key(includingpk) andetagalso reject explicitnullbefore confirmation rather than dropping their safeguards.CultureInfo.InvariantCulture, including array elements.docs/mcp.mdand the tool schema document null handling, the continuation exception, and incomplete non-resumable results.CallTool_EchoCommand_ReturnsSuccessResultnow uses a unique message. Other tests record the sameecho "hello" "world"line, and history de-duplication made its "history grows by one" assertion depend on test order.Tests
ToolOperationsCallToolTestscoversnullfor a nullable value-typed option, a string option, and a required parameter, plus invariant history formatting underde-DE. The existingnullcontinuation rejection tests are unchanged.