Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

fix: make CompleteRequest ref deserialization polymorphic#829

Open
bperhaps wants to merge 2 commits intomodelcontextprotocol:mainmodelcontextprotocol/java-sdk:mainfrom
bperhaps:fix/json-typebperhaps/mcp-java-sdk:fix/json-typeCopy head branch name to clipboard
Open

fix: make CompleteRequest ref deserialization polymorphic#829
bperhaps wants to merge 2 commits intomodelcontextprotocol:mainmodelcontextprotocol/java-sdk:mainfrom
bperhaps:fix/json-typebperhaps/mcp-java-sdk:fix/json-typeCopy head branch name to clipboard

Conversation

@bperhaps
Copy link

@bperhaps bperhaps commented Feb 22, 2026

To handle the ref (Prompt/Resource) of the Complete request reliably using Jackson polymorphic deserialization, we added type metadata (@JsonTypeInfo / @JsonSubTypes) to CompleteReference.

I also unified the server’s completion parameter parsing by replacing manual Map parsing with jsonMapper.convertValue(..., CompleteRequest.class).

Additionally, through request structure validation, cases where ref == null now fail explicitly.

Motivation and Context

While other McpSchemas specify JsonTypes, this one doesn't, leading to an error. While using this SDK, I discovered this.

I couldn't find a reason why CompleteReference was not being handled, so I'm posting a PR, deeming it an omission.

How Has This Been Tested?

i wrote some Unit test and do Integration test in local device

Breaking Changes

nop

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
  • [ x 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

@bperhaps bperhaps changed the title Fix/json type fix: make CompleteRequest ref deserialization polymorphic Feb 22, 2026
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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.