Skip to content

feat: add opt-in tool output validation#344

Draft
atesgoral wants to merge 2 commits into
modelcontextprotocol:mainfrom
atesgoral:feature/output-schema-validation
Draft

feat: add opt-in tool output validation#344
atesgoral wants to merge 2 commits into
modelcontextprotocol:mainfrom
atesgoral:feature/output-schema-validation

Conversation

@atesgoral
Copy link
Copy Markdown
Contributor

Summary

  • Add validate_tool_call_results, disabled by default, to opt into server-side output schema validation
  • Validate successful tool structuredContent against output_schema when the option is enabled
  • Treat invalid or missing structuredContent as an internal tool error and skip validation for error responses
  • Document the new option and cover default, valid, invalid, missing, and error-response behavior

Stacked on #343. This PR currently includes #343 because GitHub cannot base an upstream PR on a fork-only branch; after #343 merges, the diff should collapse to the output-validation commit.

Tests

  • dev test test TEST=test/mcp/configuration_test.rb
  • dev test test TEST=test/mcp/server_test.rb
  • dev test test TEST=test/mcp/tool/output_schema_test.rb
  • dev test test TEST=test/mcp/client_test.rb
  • dev test
  • git diff --check

Note

  • Targeted RuboCop on touched Ruby files still reports the existing Minitest/AssertEmptyLiteral offense at test/mcp/server_test.rb:713.

@atesgoral atesgoral marked this pull request as draft May 12, 2026 03:09
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