Repository navigation
Conversation
schema_for_output used schemars' default deserialize contract, so an always-written Option or #[serde(default)] field was advertised as optional and a type accepting several forms advertised all of them. Tool results are serialised; inputs keep the deserialize contract. Closes modelcontextprotocol#1374
Contributor
|
@connor4312 is on triage rotation this week and is the reviewer for this one. Labels come from the PR labeler. Please review the change. Automated triage. Labels are a first pass and the assigned maintainer has the final say. |
This branch has not been deployed
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.
Closes #1374.
schema_for_outputnow generates withSchemaSettings::draft2020_12().for_serialize(). Tool results are values the server serialises, so their schema describes whatSerializewrites: anOptionwithoutskip_serializing_ifisrequired, and a type that accepts several forms advertises only the one it writes. Inputs (schema_for_type) keep the deserialize contract. There is no public API change, and for types whose two forms are equal the output schema is unchanged.Tests:
Optionisrequiredin an output schema, and a skipped one is not;Optionstays optional, and serde does accept the missing key.Ran:
cargo test -p rmcp --all-features, CI's rmcp clippy command (all features exceptlocal,-D warnings), andcargo +nightly fmt --check.