You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elicitation form schemas containing enum definitions can be decoded as the broader string-schema variant. Because the string variant accepts the same base shape, enum-specific fields such as enum, oneOf, and legacy enumNames can be stripped before the request is sent.
A valid enum schema is projected as a plain string schema or loses enum-specific information, causing the elicitation adapter checks to fail.
Expected behavior
Valid single-select, multi-select, and legacy titled enum schemas should preserve their enum constraints and titles through decoding and protocol projection.
Regression coverage
Add schema and adapter tests covering:
enum with enumNames;
oneOf titled choices;
multi-select enum values;
defaults on enum-backed elicitation fields.
The encoded elicitation request should retain the original constraints.
fix: preserve elicitation enum variants -> Keeps standard, titled, and legacy enum forms intact when decoding elicitation schemas. (elicitation-sep1330-enums)
This one was the most suprising for me, but apparent the order of the Schema.Union resulted in a different JsonSchema being emitted since tries its members in order and accepts the first schema that successfully decodes the input.
@gcanti I get that this is mentioned in the docs, but maybe there should be a gotcha about having narrower overlapping struct schemas first since it can result in bugs like this.
for example:
import{Schema}from"effect"constPlainString=Schema.Struct({type: Schema.Literal("string")})constStringEnum=Schema.Struct({type: Schema.Literal("string"),enum: Schema.Array(Schema.String)})constinput={type: "string",enum: ["red","green"]}// Broad schema firstconstBroadFirst=Schema.Union([PlainString,StringEnum])console.log(Schema.decodeUnknownSync(BroadFirst)(input))// { type: "string" }// `enum` was treated as an excess property and removed.// Specific schema firstconstSpecificFirst=Schema.Union([StringEnum,PlainString])console.log(Schema.decodeUnknownSync(SpecificFirst)(input))// { type: "string", enum: ["red", "green"] }
Activity
[-]MCP 2025-11-25 elicitation enum schemas lose enum constraints during decoding[/-][+]fix: MCP 2025-11-25 elicitation enum schemas lose enum constraints during decoding[/+]lloydrichards commentedon Sep 4, 2026
see #8060 (comment)
lloydrichards commentedon Sep 4, 2026
This one was the most suprising for me, but apparent the order of the
Schema.Unionresulted in a differentJsonSchemabeing emitted since tries its members in order and accepts the first schema that successfully decodes the input.@gcanti I get that this is mentioned in the docs, but maybe there should be a gotcha about having narrower overlapping struct schemas first since it can result in bugs like this.
for example: