-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: Validate JSON parameters before tool execution #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Validate JSON parameters before tool execution #528
Conversation
Prevents execution of tools with invalid JSON parameters by validating JSON syntax before tool execution and showing error UI for invalid input. - Add validateJson method to DynamicJsonForm via forwardRef - Add validation check in ToolsTab before tool execution - Reuse existing JsonEditor error display for consistent UX
c524a16 to
d65ed01
Compare
|
Hi @nandsha thanks for this PR! Just wanted to give a heads up: we recently merged in a fairly large set of changes to the JSON schema handling behind the scenes, so I'm taking a little time to go through regression scenarios from other past issues before merging in more large changes to tool input validation. Will dig into this one next. |
Integrate JSON validation with copy JSON functionality: - Maintain forwardRef structure for validation exposure - Combine copy button with validation method - Both features working together without conflicts
|
Resolved merge conflicts and tested successfully. Thanks @olaservo |
- Merged JSON validation functionality from PR branch with enhanced form features from main - Preserved validateJson method and DynamicJsonFormRef interface for tool validation - Added support for oneOf schemas, enum dropdowns, and enhanced string field types - Integrated meta display functionality and resource content props - Maintained JSON validation before tool execution to prevent invalid data submission
|
Any progress? |
- Remove unnecessary escape character in regex pattern - Add missing schema dependency to useCallback hook
- Demonstrates real-time JSON validation feedback - Shows tool execution disabled on invalid JSON - Displays improved error messages and auto-reset functionality - File optimized for GitHub (709KB MP4 format)
|
Hi @olaservo , Sorry about the radio silence over the past couple of months. I have now fetched the latest from upstream, resolved merge conflicts, and have further enhanced JSON Validation by adding real-time validation improvements that build on the existing JSON validation.
Screen recording: mcp-inspector-fix-for-issue-498-v2.mp4Please review whenever you could next. Thanks! |
olaservo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this, and my bad for not reviewing it sooner!
Summary
Motivation and Context
Prevents execution of tools with invalid JSON parameters by validating JSON syntax before tool execution and showing error UI for invalid input.
How Has This Been Tested?
Yes
mcp-inspector-fix-for-issue-498.mov
Breaking Changes
No breaking changes
Types of changes
Checklist