fix(schemas): widen ServerCapabilities capability fields from Dict[str, bool] to Dict[str, Any] to match MCP SDK permissive approach#3185
Merged
crivetimihai merged 2 commits intomainfrom Feb 26, 2026
Conversation
5 tasks
Contributor
|
Hi @crivetimihai thanks for reopening this! I've verified the code, everything looks good, intact and matching my original changes. Ready for review whenever you get the chance. Thanks! |
75cd2f0 to
0a58981
Compare
kevalmahajan
previously approved these changes
Feb 25, 2026
…r, bool] to Dict[str, Any] to match MCP SDK permissive approach Closes #3063 Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
…d tests Apply the same Dict[str, bool] -> Dict[str, Any] widening to ClientCapabilities.roots for consistency: the MCP SDK's RootsCapability also uses extra="allow", so non-boolean values must be accepted. Add test_server_capabilities_non_boolean_values to both test_models.py and test_schemas.py to verify the type widening actually accepts strings, ints, and nested dicts. Closes #3063 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
0a58981 to
ac0c04c
Compare
Member
Author
ReviewReviewed and rebased onto main (clean, no conflicts). Original change (correct): Widens Review fix committed:
Checks:
LGTM ✅ |
MohanLaksh
pushed a commit
that referenced
this pull request
Mar 12, 2026
…r, bool] to Dict[str, Any] to match MCP SDK permissive approach (#3185) * fix(schemas): widen ServerCapabilities capability fields from Dict[str, bool] to Dict[str, Any] to match MCP SDK permissive approach Closes #3063 Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk> * fix(schemas): widen ClientCapabilities.roots to Dict[str, Any] and add tests Apply the same Dict[str, bool] -> Dict[str, Any] widening to ClientCapabilities.roots for consistency: the MCP SDK's RootsCapability also uses extra="allow", so non-boolean values must be accepted. Add test_server_capabilities_non_boolean_values to both test_models.py and test_schemas.py to verify the type widening actually accepts strings, ints, and nested dicts. Closes #3063 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
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.
🔗 Related Issue Closes #3063 --- ## 📝 Summary
The MCP SDK's
ToolsCapabilityusesextra: "allow", so MCP servers can return arbitrary extra fields in theircapabilities response. Our
ServerCapabilitiesmodel typedprompts,resources, andtoolsasDict[str, bool], whichrejects non-boolean values during
PydanticGateway.model_validate()when plugins are enabled. Widened these three fields toDict[str, Any]to match the SDK's permissive approach.🏷️ Type of Change
🧪 Verification
make lintmake test✅ Checklist
make black isort pre-commit)📓 Notes (optional)
Single file change (
mcpgateway/common/models.py). Existing tests continue to pass since boolean values are validAny. Nonew tests needed as the fix is purely relaxing a type constraint.