Skip to content

Conversation

@cliffhall
Copy link
Member

@cliffhall cliffhall commented Nov 3, 2025

  • In types.ts

    • add UntitledSingleSelectEnumSchema, TitledSingleSelectEnumSchema, and LegacyTitledEnumSchema
      • add SingleSelectEnumSchema that is a union of these three
    • add UntitledMultiSelectEnumSchema and TitledMultiSelectEnumSchema
      • add MultiSelectEnumSchema that is a union of these two
    • refactor EnumSchemaSchema to be a union of SingleSelectEnumSchema and MultiSelectEnumSchema
    • In ElicitResultSchema - add string array as possible return type
  • In elicitation.test.ts

    • simplify tests by extracting the duplicated client and server creation and connection logic into a beforeEach block, run in the describe block for each flow
    • add positive/negative tests for all enum permutations (single-select, multi-select, titled, untitled, and legacy)
      • "should succeed with valid selection in single-select untitled enum"
      • "should succeed with valid selection in single-select titled enum"
      • "should succeed with valid selection in single-select titled legacy enum"
      • "should succeed with valid selection in multi-select untitled enum"
      • "should succeed with valid selection in multi-select titled enum"
      • "should reject invalid selection in single-select untitled enum"
      • "should reject invalid selection in single-select titled enum"
      • "should reject invalid selection in single-select titled legacy enum"
      • "should reject invalid selection in multi-select untitled enum"
      • "should reject invalid selection in multi-select titled enum"

Motivation and Context

Update EnumSchema and extend Elicitation result to support string array return type. See SEP-1330

How Has This Been Tested?

Locally, all tests pass. New tests added.

CURRENTLY: spec.types test is failing because the spec changes aren't merged.

Breaking Changes

Nope.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

…ay return type. See [SEP-1330](modelcontextprotocol/modelcontextprotocol#1330)

* In types.ts
  - add UntitledSingleSelectEnumSchema, TitledSingleSelectEnumSchema, LegacyTitledEnumSchema
    - add SingleSelectEnumSchema that is a union of these three
  - add UntitledMultiSelectEnumSchema, TitledMultiSelectEnumSchema
    - add MultiSelectEnumSchema that is a union of these two
  - refactor EnumSchemaSchema to be a union of SingleSelectEnumSchema and MultiSelectEnumSchema

* In elicitation.test.ts
  - simplify tests by extracting the duplicated client and server creation and connection into a beforeEach run in the describe for each flow
  - add positive/negative tests for all enum permutations (single-select, multi-select, titled, untitled, and legacy
    - "should succeed with valid selection in single-select untitled enum"
    - "should succeed with valid selection in single-select titled enum"
    - "should succeed with valid selection in single-select titled legacy enum"
    - "should succeed with valid selection in multi-select untitled enum"
    - "should succeed with valid selection in multi-select titled enum"
    - "should reject invalid selection in single-select untitled enum"
    - "should reject invalid selection in single-select titled enum"
    - "should reject invalid selection in single-select titled legacy enum"
    - "should reject invalid selection in multi-select untitled enum"
    - "should reject invalid selection in multi-select titled enum"
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 8, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1077

commit: 86e367f

…pe. See [SEP-1330](modelcontextprotocol/modelcontextprotocol#1330)

* In types.ts
  - Set UntitledMultiSelectEnumSchema and TitledMultiSelectEnumSchema
    - set default to z.array(z.string()).optional()
…on-for-sep-1330' into update-enum-schema-and-elicitation-for-sep-1330
  - fix default return types on single-select with titles
  - In "should succeed with valid selection in multi-select untitled enum"
    - rename prop to colors
* In types.ts
  - add string array to ElicitResultSchema
  - Replace @ts-expect-error erroneously removed for "pattern" types

* In types.ts
  - follow the pattern of the other primitive types
    - name the zod schemas with SchemaSchema at the end
    - export types inferred from enum schemas with just Schema at the end

* In spec.types.test.ts
  - add tests for enum types
@felixweinberger
Copy link
Contributor

Hey @cliffhall thanks for this one! Closing this one in favor of #1100 by @KKonstantinov which is this PR with some rebase / merge conflict fixes on top (authorship of your commits is preserved in that PR!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants