Repository navigation
Conversation
Handlers had to check ctx.clientCapabilities() themselves before asking for elicitation, sampling or roots. Nothing stopped one from sending an input request the client never declared. Tools, prompts and resources can now declare the capabilities they cannot work without, via of(..., requiredCapabilities, handler) on McpAsync/SyncTool, McpAsync/SyncPrompt and McpAsync/SyncResource. The feature checks them before the handler runs and answers a client that lacks them with -32021, listing only what is missing. Optional input is still requested only when the client declares it. McpServer now rejects any input request for an undeclared capability as an internal error, checking URL-mode elicitation separately. This covers extension methods too. The javadoc on the handler types, InputRequired, McpRequestContext and McpException describes which strategy to use. The conformance servlet declares its requirements instead of checking them by hand. Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
Kehrlann
approved these changes
Oct 26, 2026
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.
Handlers had to check
ctx.clientCapabilities()themselves before asking for elicitation, sampling orroots. Nothing stopped one from sending an input request the client never declared.
of(..., requiredCapabilities, handler)onMcpAsync/SyncTool,McpAsync/SyncPromptandMcpAsync/SyncResource. The feature checks this before the handler runs. A client that lacks acapability gets
-32021, listing only what's missing.server enforces that.
McpServerrejects any input request for an undeclared capability as aninternal error, which covers extension methods too. URL-mode elicitation is checked separately
from form mode.
InputRequired,McpRequestContextandMcpExceptionsays which strategy to use.