-
Notifications
You must be signed in to change notification settings - Fork 438
feat: implement support for elicitation #271
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
feat: implement support for elicitation #271
Conversation
Thank you @LucaButBoring, I will try to review this PR In the future, please consider the contributing guidelines before implementing a major feature.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @LucaButBoring,
There are minor formatting issues with the import to fix.
I'm wondering if we should enforce PrimitiveSchemaDefinition types in the schema or just use Map<String, Object> instead?
We don't use these schemas for argument validation and the schema builders can still be used as external utilities, what do you think?
I guess we can also implement a dynamic schema generation from Java Class or records. But this will be task for another PR
...lcontextprotocol/server/transport/HttpServletSseServerTransportProviderIntegrationTests.java
Outdated
Show resolved
Hide resolved
Thanks for reviewing, will fix the formatting issues within the next couple of hours once I get a chance. Regarding the schema data model, the reason I went with a well-typed representation was because unlike tool input and output schemas, which are simply typed as arbitrary JSONSchema data in the specification, the kind of schema used in elicitation is actually a subset of JSONSchema, and is well-defined in the spec. In particular, the spec's elicitation schema is strictly one level deep, disallowing We could also potentially reuse the |
Implementation for the new elicitation spec (modelcontextprotocol/modelcontextprotocol#382).
Motivation and Context
Supports elicitation, which is now merged into the spec.
How Has This Been Tested?
Thorough unit and integration tests (matched sampling test cases).
Breaking Changes
None.
Types of changes
Checklist
Additional context
The Python SDK also has a PR that we can compare against (modelcontextprotocol/python-sdk#625).
The SDK data models for schema objects (used in
ElicitRequest
) are a bit complicated here - similar toContent
, schema objects are polymorphic and have atype
property, but this doesn't always allow us to directly select a subtype, requiring us to use a custom deserializer for this. The main issue isEnumSchema
, which shares thestring
type withStringSchema
, but has anenum
field to distinguish it, which can't be modeled by theJsonSubType
annotation. Tests have been implement for both serialization and deserialization for this type to make sure we can handle this correctly.