Skip to content

fix: MCP 2025-11-25 elicitation enum schemas lose enum constraints during decoding #8063

Closed

Description

@lloydrichards

Problem

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.

The external conformance scenarios expose the problem for MCP 2025-11-25:

  • elicitation-sep1034-defaults
  • elicitation-sep1330-enums

Observed behavior

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.

Activity

  1. changed the title [-]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[/+] on Sep 4, 2026
  2. lloydrichards commented on Sep 4, 2026

    @lloydrichards
    ContributorAuthor
  3. lloydrichards commented on Sep 4, 2026

    @lloydrichards
    ContributorAuthor

    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"
    
    const PlainString = Schema.Struct({
      type: Schema.Literal("string")
    })
    
    const StringEnum = Schema.Struct({
      type: Schema.Literal("string"),
      enum: Schema.Array(Schema.String)
    })
    
    const input = {
      type: "string",
      enum: ["red", "green"]
    }
    
    // Broad schema first
    const BroadFirst = Schema.Union([
      PlainString,
      StringEnum
    ])
    
    console.log(Schema.decodeUnknownSync(BroadFirst)(input))
    // { type: "string" }
    // `enum` was treated as an excess property and removed.
    
    // Specific schema first
    const SpecificFirst = Schema.Union([
      StringEnum,
      PlainString
    ])
    
    console.log(Schema.decodeUnknownSync(SpecificFirst)(input))
    // { type: "string", enum: ["red", "green"] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions