feat(server): validate accepted elicitation content against the requested schema#896
Merged
devcrocod merged 2 commits intoJul 21, 2026
Conversation
…sted schema fixes modelcontextprotocol#895 Validate accepted form-mode content in createElicitation and fail with an INVALID_PARAMS McpException on mismatch. Absent content is validated as an empty object for `required` checks; the returned result is not modified.
rea9r
marked this pull request as ready for review
July 20, 2026 05:18
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.
Validate accepted form-mode elicitation
contentagainst therequestedSchemaon the server, rejecting mismatches with anINVALID_PARAMSerror.fixes #895
Motivation and Context
createElicitationreturned accepted content to server code as-is. The specification'sform-mode security guidance says "Servers SHOULD validate received data matches the requested
schema" (2025-11-25, Form Mode Security). Comparable validation already exists in the TypeScript SDK's
elicitInputand Python'selicit_with_validationhelper. Details and design notes are in #895.How Has This Been Tested?
New unit tests for the validator and integration tests over an in-memory client–server pair.
Breaking Changes
No API changes. Behavioral note: an accepted form-mode response that does not match the requested schema now fails
createElicitationwithMcpException(INVALID_PARAMS) instead of being returned to the caller.Types of changes
Checklist