Repository navigation
Proactive Schema Sanitization for MCP Tools - #2096
Conversation
- Implements `SanitizeJSONSchema` to automatically fix common schema issues (missing `type: object`). - Integrates sanitization into `ConvertMCPToolToProto`. - Resolves compatibility issues with strict MCP clients like Claude Code. - Updates roadmap with new planned features.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@jules the git hub actions are failing. Failing GitHub actions:
CodeQL Summary: |
Thank you for the report. I see that the However, I noticed |
- Implements `SanitizeJSONSchema` to automatically fix common schema issues (missing `type: object`). - Integrates sanitization into `ConvertMCPToolToProto`. - Resolves compatibility issues with strict MCP clients like Claude Code. - Updates roadmap with new planned features. - Adds unit tests for schema sanitization.
Signed-off-by: ql-owo-lp <[email protected]>
In this change, we are going to focus on resolving Schema Validation Errors users are complaining about in GitHub issues (e.g.,
modelcontextprotocol/servers#3144,anthropics/claude-code/issues/10606), specifically where strict MCP clients reject tools due to minor schema defects like missing"type": "object".Today, I have chosen Track 1: The Friction Fighter to focus on: Proactive Schema Sanitization because it directly addresses the user's need for reliability and compatibility, ensuring that tools generated from various upstream sources (like OpenAPI specs) work seamlessly even with strict clients.
The Investigation Report:
modelcontextprotocol/servers#3144,anthropics/claude-code/issues/10606).propertiesbut is missing"type": "object", the client rejects the tool or crashes the session.The Implementation:
SanitizeJSONSchemainserver/pkg/tool/schema_sanitizer.go. This function recursively walks the JSON schema. If it detects a schema object withpropertiesbut notype, it injects"type": "object".ConvertMCPToolToProtoinserver/pkg/tool/converters.goto callSanitizeJSONSchemabefore converting the schema to a protobuf struct. This ensures that all tools registered via this path (e.g., from dynamic configs) are sanitized before being exposed to clients.server/pkg/tool/schema_sanitizer_test.gowith unit tests covering simple and nested schema sanitization scenarios. Verified thatgo test ./server/pkg/tool/passes.The Continuity Check:
server/roadmap.md:Testing & CI:
server/pkg/tool/passed.PR created automatically by Jules for task 8077596153217320016 started by @ql-owo-lp