-
Notifications
You must be signed in to change notification settings - Fork 961
fix: resolve $ref references in tool input schema properties #889
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
Conversation
|
Thanks for working on this! 🎉 I was also tackling Issue #897 and noticed a couple of additional scenarios that might need attention:
I've been working on these cases in my branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing, but this looks good so far.
See modelcontextprotocol/inspector#889 * In tools.ts - modified AddSchema - tests simple primitive refs - extracted z.number() to a variable that is referenced for a and b properties - modified ComplexOrderSchema - tested object refs - extracted shipping address properties to address variable - referenced address from shippingAddress property - added billing address property that references address
Hi @Edison-A-N! I've just tested this one and it looks pretty good. I am going to go ahead and merge it since it seems rather simple. But the cases that you are working on need to be fixed as well, particularly |
cliffhall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.



Motivation and Context
Previously, when a tool's input schema contained $ref references (e.g.,
"$ref": "#/properties/source"), the ToolsTab component would incorrectly
render the referenced property as an object type instead of resolving
the reference to the actual schema definition.
This caused issues where properties that should inherit from other

properties (like string types with validation rules) were rendered as
complex object forms instead of simple input fields.
before:
after:

image
How Has This Been Tested?
Tested with MCP tools that use $ref references in their input schemas.
For example, a schema with:
{ "properties": { "source": { "type": "string", "minLength": 1, "description": "test" }, "target": { "$ref": "#/properties/source" } } }Now correctly renders both
sourceandtargetas string input fieldswith the same validation rules, instead of rendering
targetas anobject form.
Breaking Changes
No breaking changes.
Types of changes
Checklist