Repository navigation
fix(core): resolve and preserve MCP tool inputSchema $defs/$ref definitions - #395
Merged
qorzj merged 2 commits intoNov 4, 2026
Merged
Conversation
Collaborator
|
Updated the PR to preserve schema references and constraints, and address #396 with tuple compatibility conversion. Affected tools validate arguments against the original schema before MCP calls, without coercing values, adding defaults, or removing fields. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When MCP servers (such as
@runpod/mcp-server) return toolinputSchemaobjects containing JSON Schema$refpointers (e.g.,"$ref": "#/$defs/CreateDelegationRequest"or"$ref": "#/definitions/..."),McpManager.getMcpToolDefinitions()previously copied onlyproperties,required, andadditionalPropertiesfrominputSchema, dropping$defsanddefinitions.As a result, the LLM API rejected requests with:
Changes
normalizeMcpInputSchema()inpackages/core/src/mcp/mcp-manager.tsto:#/$defs/<Key>and#/definitions/<Key>$refpointers (merging sibling keywords and flattening single-elementallOfwrappers, with cycle detection).$defsanddefinitionsonparameterswhen any unresolved/cyclic$refremains.McpToolDefinitionandToolDefinitiontypes to include optional$defsanddefinitions.packages/core/src/tests/mcp-client.test.tscovering both inlined$defs/definitionsreferences and cyclic$refpreservation.