Skip to content

refactor: share tool schema validation helpers#345

Closed
atesgoral wants to merge 1 commit into
modelcontextprotocol:mainfrom
atesgoral:refactor/schema-validation-common
Closed

refactor: share tool schema validation helpers#345
atesgoral wants to merge 1 commit into
modelcontextprotocol:mainfrom
atesgoral:refactor/schema-validation-common

Conversation

@atesgoral
Copy link
Copy Markdown
Contributor

Summary

  • Move the shared JSON Schema data-validation flow into MCP::Tool::Schema
  • Keep InputSchema#validate_arguments and OutputSchema#validate_result as thin public wrappers with unchanged error messages
  • Share schema coercion between the input_schema and output_schema setters

Tests

  • dev test test TEST=test/mcp/tool/input_schema_test.rb
  • dev test test TEST=test/mcp/tool/output_schema_test.rb
  • dev test test TEST=test/mcp/tool_test.rb
  • dev test test TEST=test/mcp/server_test.rb
  • dev test test TEST=test/mcp/configuration_test.rb
  • dev test
  • bundle exec rubocop lib/mcp/tool.rb lib/mcp/tool/schema.rb lib/mcp/tool/input_schema.rb lib/mcp/tool/output_schema.rb
  • git diff --check

@atesgoral atesgoral force-pushed the refactor/schema-validation-common branch 2 times, most recently from bee7308 to 8236674 Compare May 13, 2026 02:54
@atesgoral atesgoral force-pushed the refactor/schema-validation-common branch from 8236674 to bffbc8d Compare May 13, 2026 02:57
@atesgoral atesgoral closed this May 13, 2026
@atesgoral
Copy link
Copy Markdown
Contributor Author

This attempt at deduplication wasn't leading to cleaner code or reduction in LOC. Closing.

@atesgoral atesgoral deleted the refactor/schema-validation-common branch May 13, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant