Skip to content

Conversation

@felixweinberger
Copy link
Contributor

Implements client-side default value application for elicitation responses as specified by SEP-1034.

Motivation and Context

SEP-1034 specifies that clients SHOULD apply default values when users omit optional fields in elicitation responses. This PR implements this behavior by overriding setRequestHandler to automatically apply defaults from the schema before sending responses back to the server.

How Has This Been Tested?

  • All 34 elicitation tests pass (17 AJV + 17 CfWorker validators)
  • 768/769 SDK tests pass (1 flaky test unrelated to changes)
  • Validated against SEP-1034 conformance tests (5/5 pass):
    • String, integer, number, enum, and boolean defaults all applied correctly
    • Client returns empty {}, SDK fills in defaults automatically

Breaking Changes

None.

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

Additional context

This implements the client-side responsibility for SEP-1034 default values. The Client SDK automatically applies defaults using the configured JSON Schema validator (AJV or CfWorker) when elicitation handlers return partial/empty content.

KKonstantinov and others added 3 commits November 11, 2025 01:40
Override setRequestHandler to automatically apply defaults for elicitation
responses. When clients return partial/empty content, the SDK fills in
defaults from the schema before sending the response back to the server.
@felixweinberger felixweinberger requested a review from a team as a code owner November 11, 2025 13:17
@felixweinberger felixweinberger marked this pull request as draft November 11, 2025 13:18
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1097

commit: f44a0bf

@felixweinberger
Copy link
Contributor Author

close in favor of #1096

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.

3 participants