-
Notifications
You must be signed in to change notification settings - Fork 841
MCP 6/18/25: Elicitation support #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Added comprehensive elicitation support including: - Client-side handler infrastructure following sampling pattern - Server-side Context.elicit() method with type safety and validation - Support for primitive types (str, int, float, bool) with automatic wrapping - Support for dataclasses and other complex types - Pattern matching with AcceptedElicitation, DeclinedElicitation, CancelledElicitation - Comprehensive atomic test coverage for all scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
8 tasks
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.
FastMCP now supports elicitation - the ability for MCP servers to request additional information from users during tool execution. This enables interactive workflows where tools can ask for clarification, gather missing data, or prompt for user confirmation.
Closes #970
Closes #850
Closes #466
Implements a clean DX for modelcontextprotocol/modelcontextprotocol#382
Key Implementation Features
FastMCP Convenience Layer
While MCP elicitation only supports flat object schemas with primitive properties, FastMCP provides convenient abstractions:
str
,int
,bool
,float
) are automatically wrapped in object schemas and unwrapped on responseLiteral
types,Enum
classes, and lists of strings as a shortcut for constrained optionsUsage Examples
Simple scalar elicitation (auto-wrapped):
Constrained choices (all equivalent, produce enum schema):
Structured data:
All approaches automatically generate MCP-compliant JSON schemas with proper enum constraints and handle the complexity of wrapping/unwrapping data for seamless developer experience.
Client Integration
Documentation Structure
Added comprehensive documentation following the established FastMCP pattern:
/servers/elicitation
- Complete usage patterns and examples/clients/elicitation
- Handler implementation guide/servers/context
with cross-referencesThe implementation maintains full MCP protocol compatibility while providing the developer experience FastMCP is known for.