Skip to content

Validate sampling JSON object fields#221

Closed
leehack wants to merge 2 commits into
spec/finite-json-number-validationfrom
spec/sampling-json-object-validation
Closed

Validate sampling JSON object fields#221
leehack wants to merge 2 commits into
spec/finite-json-number-validationfrom
spec/sampling-json-object-validation

Conversation

@leehack

@leehack leehack commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add shared JSON-object validation that rejects non-string keys, non-JSON values, and non-finite nested numbers
  • validate sampling object fields during parse and serialization, including tool-use input, sampling message metadata, content annotations, content _meta, and create-message metadata
  • cover both MCP 2025-11-25 and MCP 2026-07-28 RC regression tests

Validation

  • dart format .
  • dart test test/types/sampling_test.dart
  • dart test test/mcp_2025_11_25_test.dart
  • dart test test/mcp_2026_07_28_test.dart
  • dart analyze
  • dart test
  • git diff --check
  • (cd packages/mcp_dart_cli && dart run mcp_dart_cli:mcp_dart conformance --suite all --json)

@leehack leehack force-pushed the spec/sampling-json-object-validation branch from f0091ed to 802ade1 Compare June 1, 2026 01:55
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.21%. Comparing base (b1134cd) to head (4b37a45).

Files with missing lines Patch % Lines
lib/src/types/sampling.dart 98.00% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           spec/finite-json-number-validation     #221      +/-   ##
======================================================================
+ Coverage                               88.13%   88.21%   +0.07%     
======================================================================
  Files                                      47       47              
  Lines                                    9179     9204      +25     
======================================================================
+ Hits                                     8090     8119      +29     
+ Misses                                   1089     1085       -4     
Flag Coverage Δ
unittests 88.21% <98.21%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leehack

leehack commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

Closing this draft micro PR because the RC spec work has been consolidated into a smaller reviewable stack. This change is preserved in #270 (JSON-RPC metadata hardening); the consolidated tip is tree-identical to the previous micro-stack tip.

@leehack leehack closed this Jun 1, 2026
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