Repository navigation
Read an elicitation mode the same way in require_client_capability! and name the mode a client left out - #742
Open
koic wants to merge 1 commit into
Conversation
… and name the mode a client left out ## Motivation and Context modelcontextprotocol#731 made the server read a client's elicitation declaration by the rule of the specification: a declaration that names no mode, such as `elicitation: {}`, is form mode, and one that names only `url` is not. Two places did not follow. - `ServerContext#require_client_capability!(:elicitation, :form)`, the example in the comment of that method, walked the declaration key by key, so it raised `-32021` for a client that declared `elicitation: {}`, while `create_form_elicitation` and the check of an `input_required` result served the same client. It now reads an elicitation mode through the same check as they do. Any other path is walked as before. - `create_form_elicitation` answered a client that declared only `elicitation.url` with "The client must declare the `elicitation` capability", which that client did. A client that declared the capability without form mode is now told that `elicitation.form`, or `elicitation` without a mode, is missing. A client that declared nothing gets the message it got before. The paragraph modelcontextprotocol#731 added to the elicitation docs now breaks between its sentences, and says that a mode declared as `false`, as in `elicitation: { url: false }`, still names a mode, so that declaration is not form mode. Follow-up to modelcontextprotocol#731. ## How Has This Been Tested? `test/mcp/server_context_test.rb` and `test/mcp/server_elicitation_test.rb`. Before this change, `require_client_capability!(:elicitation, :form)` raised for `elicitation: {}`. ## Breaking Changes None. A tool that guarded on `require_client_capability!(:elicitation, :form)` no longer refuses a client that declared `elicitation` without a mode, which the elicitation methods already served.
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.
Motivation and Context
#731 made the server read a client's elicitation declaration by the rule of the specification: a declaration that names
no mode, such as
elicitation: {}, is form mode, and one that names onlyurlis not. Two places did not follow.ServerContext#require_client_capability!(:elicitation, :form), the example in the comment of that method, walked the declaration key by key, so it raised-32021for a client that declaredelicitation: {}, whilecreate_form_elicitationand the check of aninput_requiredresult served the same client. It now reads an elicitation mode through the same check as they do. Any other path is walked as before.create_form_elicitationanswered a client that declared onlyelicitation.urlwith "The client must declare theelicitationcapability", which that client did. A client that declared the capability without form mode is now told thatelicitation.form, orelicitationwithout a mode, is missing. A client that declared nothing gets the message it got before.The paragraph #731 added to the elicitation docs now breaks between its sentences, and says that a mode declared as
false, as inelicitation: { url: false }, still names a mode, so that declaration is not form mode.Follow-up to #731.
How Has This Been Tested?
test/mcp/server_context_test.rbandtest/mcp/server_elicitation_test.rb. Before this change,require_client_capability!(:elicitation, :form)raised forelicitation: {}.Breaking Changes
None. A tool that guarded on
require_client_capability!(:elicitation, :form)no longer refuses a client that declaredelicitationwithout a mode, which the elicitation methods already served.Types of changes
Checklist