Skip to content

fix: preserve elicit string pattern constraints#1999

Open
Genmin wants to merge 1 commit intomodelcontextprotocol:mainfrom
Genmin:fix/elicit-primitive-json-schema-keywords
Open

fix: preserve elicit string pattern constraints#1999
Genmin wants to merge 1 commit intomodelcontextprotocol:mainfrom
Genmin:fix/elicit-primitive-json-schema-keywords

Conversation

@Genmin
Copy link
Copy Markdown

@Genmin Genmin commented Apr 30, 2026

Summary

  • Preserve pattern on elicitation string property schemas instead of stripping it during validation.
  • Cover both direct StringSchemaSchema parsing and nested ElicitRequestFormParamsSchema parsing.
  • Document the temporary generated-spec type mismatch: the written 2025-11-25 elicitation spec includes StringSchema.pattern, while spec.types.ts is still missing it.

Notes

This intentionally keeps the change narrow to the spec-backed string pattern field rather than making all primitive schemas permissive. It addresses the concrete pattern loss described in #1844 without broad passthrough behavior.

Spec reference: https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation

Validation

  • pnpm --filter @modelcontextprotocol/core exec vitest run test/types.test.ts test/spec.types.test.ts
  • pnpm --filter @modelcontextprotocol/core run typecheck
  • pnpm --filter @modelcontextprotocol/core exec prettier --ignore-path ../../.prettierignore --check src/types/schemas.ts test/types.test.ts test/spec.types.test.ts
  • pre-push hook: pnpm -r typecheck, pnpm -r build, pnpm sync:snippets --check && pnpm -r lint

@Genmin Genmin requested a review from a team as a code owner April 30, 2026 19:00
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: 34e7438

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 30, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@1999

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@1999

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@1999

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@1999

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@1999

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@1999

commit: 34e7438

@Genmin Genmin force-pushed the fix/elicit-primitive-json-schema-keywords branch from 04a193d to 34e7438 Compare April 30, 2026 19:04
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.

1 participant