Skip to content

feat(server): validate accepted elicitation content against the requested schema#896

Merged
devcrocod merged 2 commits into
modelcontextprotocol:mainfrom
rea9r:feat/elicitation-content-validation
Jul 21, 2026
Merged

feat(server): validate accepted elicitation content against the requested schema#896
devcrocod merged 2 commits into
modelcontextprotocol:mainfrom
rea9r:feat/elicitation-content-validation

Conversation

@rea9r

@rea9r rea9r commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Validate accepted form-mode elicitation content against the requestedSchema on the server, rejecting mismatches with an INVALID_PARAMS error.

fixes #895

Motivation and Context

createElicitation returned accepted content to server code as-is. The specification's
form-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 elicitInput and Python's elicit_with_validation helper. 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 createElicitation with McpException (INVALID_PARAMS) instead of being returned to the caller.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

…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
rea9r marked this pull request as ready for review July 20, 2026 05:18

@devcrocod devcrocod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
thanks!

@devcrocod
devcrocod merged commit 737b46f into modelcontextprotocol:main Jul 21, 2026
19 checks passed
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.

Validate accepted form-mode elicitation content against the requested schema on the server

2 participants