Backfills trace injection test and migrates from request.params to request.params._meta#360
Merged
stephentoub merged 2 commits intomodelcontextprotocol:mainfrom Apr 29, 2025
Conversation
Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
This was referenced Apr 28, 2025
Contributor
|
cc: @lmolkova, @samsp-msft |
stephentoub
approved these changes
Apr 29, 2025
halter73
approved these changes
Apr 29, 2025
17a9427
into
modelcontextprotocol:main
13 of 14 checks passed
This was referenced Jul 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Before, trace IDs were encoded in the
request.paramsobject which co-mingled it with fields like tool arguments.This backfills an encoding test and moves it to
request.params._metawhich is used elsewhere and proposed as a convention due to prior art and also being a bit safer for ad-hoc implementation regardless of this implementation being careful.This also corrects logic to replace any existing key in the message however unlikely that might be.
How Has This Been Tested?
Backfilled a unit test
Breaking Changes
The choice to use request.params was released in https://github.com/modelcontextprotocol/csharp-sdk/releases/tag/v0.1.0-preview.9. This changes it to
request.params._meta. This means that applications already releasing this will need to update both sides to have context propagation. Since this SDK is in pre-release, I didn't add logic to fall back to extract fromrequest.paramsTypes of changes
Checklist
Additional context
request.paramsOpenTelemetry: context propagation and semconv update #262request.params._metafor use in opentelemetry traces as well other metadata: SEP-414: Document OpenTelemetry Trace Context Propagation Conventions modelcontextprotocol#414