Skip to content

Fix fundamental schema issue with required fields defined incorrectly on JsonSchemaType #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

olaservo
Copy link
Member

@olaservo olaservo commented Jun 1, 2025

Fixes a critical schema architecture problem identified by @max-stytch where the JsonSchemaType definition violated the JSON Schema specification. JsonSchemaType incorrectly defined required as boolean on individual properties instead of string[] array on parent object schema, leading to unexpected behavior in some tools testing scenarios and several open issues.

Motivation and Context

Related observed issues:

How Has This Been Tested?

Did some basic testing but still working on more methodically testing the different scenarios. Thought it would be worth opening now for visibility's sake.

Breaking Changes

Technically yes due to internal API changes, however these all restore the correct behavior behind the scenes and don't require any changes on the user side:

  • generateDefaultValue() function signature changed to include propertyName and parentSchema parameters
  • JsonSchemaType.required changed from boolean to string[]
  • Components using prop.required logic needed updates

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

@olaservo olaservo marked this pull request as ready for review June 5, 2025 01:35
@olaservo olaservo requested a review from cliffhall June 5, 2025 13:32
Copy link
Contributor

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a couple of places where isPropertyRequired helper can be used.

@olaservo olaservo requested review from cliffhall and pcarleton June 12, 2025 10:59
Copy link
Contributor

@pcarleton pcarleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth debugger changes lgtm!

@cliffhall
Copy link
Contributor

Do we have a goto in-project example, in the SDK or servers repo that could be used to exercise the various schema-related stuff like required fields and nested fields in input and output schemas?

@max-stytch
Copy link
Contributor

Do we have a goto in-project example, in the SDK or servers repo that could be used to exercise the various schema-related stuff like required fields and nested fields in input and output schemas?

I want to put together a little Cloudflare Worker that can take in a generic tool schema and then generate an unauthenticated MCP Server URL that we can share for testing purposes. Just haven't had the time 😢

@cliffhall
Copy link
Contributor

Do we have a goto in-project example, in the SDK or servers repo that could be used to exercise the various schema-related stuff like required fields and nested fields in input and output schemas?

I want to put together a little Cloudflare Worker that can take in a generic tool schema and then generate an unauthenticated MCP Server URL that we can share for testing purposes. Just haven't had the time 😢

That's cool and useful, and don't want to dissuade you from doing so. But I'm mainly looking for in-project stuff that we maintain with no external dependencies.

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.

4 participants