Skip to content

Support elicitation/create per MCP specification#312

Open
koic wants to merge 1 commit intomodelcontextprotocol:mainfrom
koic:support_elicitation
Open

Support elicitation/create per MCP specification#312
koic wants to merge 1 commit intomodelcontextprotocol:mainfrom
koic:support_elicitation

Conversation

@koic
Copy link
Copy Markdown
Member

@koic koic commented Apr 13, 2026

Motivation and Context

The MCP specification (2025-11-25) defines elicitation as a server-to-client request mechanism that allows servers to request user input during tool execution: https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation

This aligns with the Python SDK, which also exposes separate methods for form and URL mode elicitation. Three methods are added following the Python SDK's API design:

  • create_form_elicitation: collects structured data via JSON Schema
  • create_url_elicitation: directs users to external URLs for sensitive interactions (OAuth, credentials, etc.)
  • notify_elicitation_complete: notifies the client that a URL mode interaction has completed

URLElicitationRequiredError (error code -32042) is defined as a subclass of RequestHandlerError with its own error_code and error_data attributes. JsonRpcHandler#handle_request_error is extended to check for these attributes so that MCP-specific error codes can be propagated without embedding MCP knowledge in the generic JSON-RPC layer.

How Has This Been Tested?

  • Unit tests for ServerSession form/URL mode, capability checks, nil capabilities, notification, and URLElicitationRequiredError
  • ServerContext delegation tests for all three elicitation methods
  • JsonRpcHandler tests for custom error code and fallback behavior
  • Methods capability test for NOTIFICATIONS_ELICITATION_COMPLETE
  • Conformance tests pass (40/40), including tools-call-elicitation, elicitation-sep1034-defaults, and elicitation-sep1330-enums
  • All tests pass (rake test), RuboCop is clean

Breaking Changes

None. This is a new feature addition.

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

@koic koic force-pushed the support_elicitation branch 2 times, most recently from 3c50f76 to ef739d9 Compare April 13, 2026 05:38
## Motivation and Context

The MCP specification (2025-11-25) defines elicitation as a server-to-client
request mechanism that allows servers to request user input during tool execution:
https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation

This aligns with the Python SDK, which also exposes separate methods for form and URL mode elicitation.
Three methods are added following the Python SDK's API design:

- `create_form_elicitation`: collects structured data via JSON Schema
- `create_url_elicitation`: directs users to external URLs for sensitive
  interactions (OAuth, credentials, etc.)
- `notify_elicitation_complete`: notifies the client that a URL mode
  interaction has completed

`URLElicitationRequiredError` (error code `-32042`) is defined as a subclass of `RequestHandlerError`
with its own `error_code` and `error_data` attributes. `JsonRpcHandler#handle_request_error` is
extended to check for these attributes so that MCP-specific error codes can be propagated without
embedding MCP knowledge in the generic JSON-RPC layer.

## How Has This Been Tested?

- Unit tests for `ServerSession` form/URL mode, capability checks, nil
  capabilities, notification, and `URLElicitationRequiredError`
- `ServerContext` delegation tests for all three elicitation methods
- `JsonRpcHandler` tests for custom error code and fallback behavior
- `Methods` capability test for `NOTIFICATIONS_ELICITATION_COMPLETE`
- Conformance tests pass (40/40), including `tools-call-elicitation`,
  `elicitation-sep1034-defaults`, and `elicitation-sep1330-enums`
- All tests pass (`rake test`), RuboCop is clean
- Verified form mode elicitation end-to-end with a sample MCP server
  running in Claude Code

## Breaking Changes

None. This is a new feature addition.
@koic koic force-pushed the support_elicitation branch from ef739d9 to 985fd03 Compare April 13, 2026 06:21
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