-
Notifications
You must be signed in to change notification settings - Fork 65
Add Tool output_schema support with comprehensive validation #133
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
Conversation
This commit implements optional JSON Schema validation for tool outputs according to the MCP specification: - Add MCP::Tool::OutputSchema class mirroring InputSchema functionality - Support output_schema in class definitions, Tool.define, and OutputSchema objects - Include validate_result method for runtime validation - Update MCP::Client::Tool to track output schemas - Add comprehensive test coverage with 249 passing tests - Update README with dedicated Tool Output Schemas section - Follow MCP spec requirements for server/client validation
accept_uri: false, | ||
accept_file: ->(path) { path.to_s.start_with?(Gem.loaded_specs["json-schema"].full_gem_path) }, | ||
) | ||
metaschema = JSON::Validator.validator_for_name("draft4").metaschema |
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.
This could use the same fix in #132 to work on Windows
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.
But it can be a follow-up
This is awesome! |
It looks like a merge commit has been added. It might be better to undo this merge commit (e.g., |
@koic Ah I wasn't aware GitHub was defaulting to merging instead of doing a regular rebase when the UI is used. Good to know for the future! |
Added comprehensive support for optional JSON Schema validation of tool outputs according to the MCP specification.
Motivation and Context
This implements the
Tool
'soutputSchema
according the the latest specification.How Has This Been Tested?
Extensive tests have been added mirroring those of the
input_schema
which follow very similar structure and rules.Breaking Changes
None. This is fully backwards-compatible.
Types of changes
MCP::Tool::OutputSchema
class mirroringInputSchema
functionalityoutput_schema
in class definitions,Tool.define
, andOutputSchema
objectsvalidate_result
method to support runtime validationMCP::Client::Tool
to track output schemasChecklist