Skip to content

feat: add opt-in tool output validation#344

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
atesgoral:feature/output-schema-validation
May 13, 2026
Merged

feat: add opt-in tool output validation#344
koic merged 1 commit into
modelcontextprotocol:mainfrom
atesgoral:feature/output-schema-validation

Conversation

@atesgoral
Copy link
Copy Markdown
Contributor

@atesgoral atesgoral commented May 12, 2026

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

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
@atesgoral atesgoral force-pushed the feature/output-schema-validation branch from 8d5910a to 407b064 Compare May 12, 2026 20:20
@atesgoral atesgoral marked this pull request as ready for review May 12, 2026 20:21
@koic koic merged commit 075ae28 into modelcontextprotocol:main May 13, 2026
11 checks passed
@atesgoral atesgoral deleted the feature/output-schema-validation branch May 13, 2026 02:07
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.

2 participants