Skip to content

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
modelcontextprotocol:mainfrom
koic:read_an_elicitation_mode_the_same_way_in_require_client_capability
Open

koic wants to merge 1 commit into
modelcontextprotocol:mainfrom
koic:read_an_elicitation_mode_the_same_way_in_require_client_capability

Conversation

@koic

@koic koic commented Dec 1, 2026

Copy link
Copy Markdown
Member

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 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 #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 #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.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Test update (non-breaking change which adds or updates tests)
  • Refactoring (non-breaking change which makes things better)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • CI/build script update (update CI workflow or build scripts)

Checklist

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

… 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

No deployments
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