Add support for SEP-1330 Elicitation Enums#952
Merged
olaservo merged 5 commits intomodelcontextprotocol:mainfrom Dec 10, 2025
Merged
Add support for SEP-1330 Elicitation Enums#952olaservo merged 5 commits intomodelcontextprotocol:mainfrom
olaservo merged 5 commits intomodelcontextprotocol:mainfrom
Conversation
In DynamicJsonForm.tsx,
- Support all five enum shapes used by MCP SDK:
- Titled single-select via `oneOf`/`anyOf` with `{ const, title }`
- Untitled single-select via `enum`
- Titled legacy single-select with optional `enumNames` for labels
- Titled multi-select via `items.anyOf`/`oneOf`
- Untitled multi-select via `items.enum`
- Show field descriptions for string select fields and boolean checkboxes (consistent help text above inputs).
- Prefer schema property `title` for object field labels; fall back to the JSON key when missing.
- Allow top‑level form rendering for objects with properties, arrays with items, and primitive types (was overly strict before).
- Multi-select UI: sensible list size and `minItems`/`maxItems` helper text when present.
- JSON editor fallback, copy/format controls, and debounced parsing preserved.
- apply defaults for optional fields during form init
In schemaUtils.ts
- `generateDefaultValue` now includes optional properties that declare a `default`, ensuring fields like strings show their defaults on first render.
In jsonUtils.ts
- Add legacy `enumNames?: string[]` and array constraints `minItems?`/`maxItems?`.
12 tasks
- Align tests with new form-first rendering and UI behavior:
- Labels prefer schema `title` over property key.
- Descriptions shown for boolean checkboxes and select fields.
- Explicit mode switching between Form/JSON when needed.
- Add comprehensive coverage for enum schema variants:
- Titled single-select via `oneOf`/`anyOf` with `{ const, title }`.
- Untitled single-select via `enum` (with legacy `enumNames` labels).
- Untitled multi-select via `items.enum` with `minItems`/`maxItems` helper text.
- Titled multi-select via `items.anyOf`/`oneOf` with `{ const, title }`.
- Adjust complex/JSON-mode tests to click “Switch to JSON” before asserting textarea and clipboard interactions.
- Fix debounced JSON update expectations to assert parsed objects rather than raw text.
Files updated:
- `client/src/components/__tests__/DynamicJsonForm.test.tsx`
- `client/src/components/__tests__/DynamicJsonForm.array.test.tsx`
olaservo
approved these changes
Dec 10, 2025
Member
olaservo
left a comment
There was a problem hiding this comment.
Tested with latest everything server on Chrome with SSE, HTTP, STDIO.
This was referenced Dec 13, 2025
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.
Summary
Allows the DynamicJsonForm to render the various enum types supported by the new version of the spec (SEP-1330).
Changes Made
In DynamicJsonForm.tsx,
oneOf/anyOfwith{ const, title }enumenumNamesfor labelsitems.anyOf/oneOfitems.enumtitlefor object field labels; fall back to the JSON key when missing.minItems/maxItemshelper text when present.In schemaUtils.ts
generateDefaultValuenow includes optional properties that declare adefault, ensuring fields like strings show their defaults on first render.In jsonUtils.ts
enumNames?: string[]and array constraintsminItems?/maxItems?.Type of Change
Related Issues
#933
Testing
Test Results and/or Instructions
Used this PR for the Everything server which updates it Elicitation Request to have all the fields.
Checklist
npm run prettier-fix)Breaking Changes
Nope.
Additional Context
For more on the various enum types now supported by the protocol, see SEP-1330