Improved Tool Schema Validation for Broader MCP Server Compatibility#2342
Merged
kevalmahajan merged 1 commit intomainfrom Jan 23, 2026
Merged
Improved Tool Schema Validation for Broader MCP Server Compatibility#2342kevalmahajan merged 1 commit intomainfrom
kevalmahajan merged 1 commit intomainfrom
Conversation
56ce7bf to
ef295a3
Compare
…patibility - Use jsonschema.validators.validator_for to detect schema draft automatically - Support multiple JSON Schema drafts (Draft 4, 6, 7, 2019-09, 2020-12) - Log warnings for unsupported drafts or invalid schemas instead of raising errors - Handle None schemas gracefully - Apply consistent validation behavior to both tool and prompt schemas - Add comprehensive tests for different schema drafts - Add fallback validator logic in tool_service.py for runtime validation - Disable MCP SDK's built-in input validation which uses strict Draft 2020-12 Closes #2322 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
ef295a3 to
579597a
Compare
Member
Additional Fixes AddedDuring integration testing against real MCP servers, discovered and fixed additional issues: Changes
TestingVerified against:
Both servers now register and invoke tools successfully. RelatedCreated issue #2348 to track feedback about behavioral changes (invalid schemas now persist with warnings rather than errors). |
crivetimihai
approved these changes
Jan 23, 2026
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
…patibility (IBM#2342) - Use jsonschema.validators.validator_for to detect schema draft automatically - Support multiple JSON Schema drafts (Draft 4, 6, 7, 2019-09, 2020-12) - Log warnings for unsupported drafts or invalid schemas instead of raising errors - Handle None schemas gracefully - Apply consistent validation behavior to both tool and prompt schemas - Add comprehensive tests for different schema drafts - Add fallback validator logic in tool_service.py for runtime validation - Disable MCP SDK's built-in input validation which uses strict Draft 2020-12 Closes IBM#2322 Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
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.
🐛 Bug-fix PR
📌 Summary
Closes #2322
This PR fixes an issue with the validation of JSON Schemas attached to tools during insert/update operations causing failure of registration of some MCP servers in Context Forge Gateway.
Previously, only Draft 7 schemas were checked, and invalid schemas would raise a ValueError. The new implementation:
This improves stability and provides better visibility into schema issues.
🔁 Reproduction Steps
🐞 Root Cause
💡 Fix Description
🧪 Verification
make lintmake testmake coverage📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)