Fix compress_schema to preserve additionalProperties: false for MCP compatibility#3102
Fix compress_schema to preserve additionalProperties: false for MCP compatibility#3102
Conversation
…ompatibility Changes: - Changed default of prune_additional_properties from True to False in compress_schema - Added test demonstrating MCP client compatibility requirement - Updated existing tests to explicitly enable pruning when needed - Added additionalProperties: false to manually constructed schemas in tool_transform - Updated inline snapshots to reflect new behavior Fixes #3008 Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
WalkthroughThe pull request modifies JSON schema handling across two files to ensure stricter validation of tool parameters. In Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Failure AnalysisSummary: The Windows CI job is timing out in Root Cause: The test creates a subprocess-based MCP server and connects to it via a Client. Windows subprocess creation and stdio communication is significantly slower than Linux, causing the test to exceed the 5-second timeout. The test passes on all Linux runners (Ubuntu with Python 3.10, 3.13, and lowest-direct dependencies) but consistently times out on Windows. Suggested Solution: Add a
Detailed AnalysisTest Execution LogThe test begins at line 430 and times out after the 5-second default: The last log line shows "Stdio transport connected", indicating the subprocess connection was established but the test timed out before completing the Why This Fails on Windows Only
Related Files
🤖 This analysis was generated by marvin |
Fixes #3008
Summary
The
compress_schemafunction was defaulting toprune_additional_properties=True, which removedadditionalProperties: falsefrom JSON schemas. This broke compatibility with MCP clients like Claude that require strict JSON schemas withadditionalProperties: false.Changes
prune_additional_propertiesfromTruetoFalseincompress_schemaadditionalProperties: falseto manually constructed schemas intool_transform.pyTesting
Generated with Claude Code) | View branch | [View job run](https://github.com/jlowin/fastmcp/actions/runs/21443654395