Repository navigation
Preserve decimal precision in MCP tool arguments - #420
Closed
sylvesterkaczmarek wants to merge 1 commit into
Closed
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
Author
|
The complete MCP module tests pass locally (36 tests), along with its formatting and detekt checks. Could a maintainer approve the pending CI workflow? |
Contributor
|
Closing along with #419. The reasoning is in #419 (comment). |
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.
Fixes #419.
Enable
USE_BIG_DECIMAL_FOR_FLOATSon the private mapper used byBetaMcp. Decimal and exponent-form arguments then reach the MCP client without rounding, overflow to infinity, or underflow to zero.Integral parsing remains unchanged. Decimal values inside the outgoing
CallToolRequestmap are nowBigDecimalrather thanDouble; they continue to serialize as JSON numbers. Public method signatures and result conversion are unchanged.Nine regression cases check precise decimals, values beyond Double's exponent range, nested lists/objects, a large integer control, strings/booleans/null/empty objects, numeric serialization and malformed-input rejection before invoking the client.
Validation
anthropic-java-mcptest module: 36 passed, none skipped.formatKotlin,detektMain,detektTestandlintKotlintasks passed.git diff --checkpassed.Tested on macOS arm64 with JDK 21 and the repository's locked dependencies. The MCP client is mocked at its request boundary; live MCP transport and the full multi-module SDK suite were not run. Existing Gradle/JVM warnings remain. No dependency or workflow changes.