feat(client): add _meta support to call_tool for tool calls\n\n- Adds… #1003
+123
−3
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.
Adds optional
_metaparameter support toClientSession.call_toolandClientSessionGroup.call_toolmethods, enabling users to pass request metadata (such as progress tokens or user context) in a clean, explicit, and backward-compatible way.Motivation and Context
Currently, users who need to pass metadata (like progress tokens or user context) to tool calls have to work around the SDK's limitations by either:
call_toolargumentsparameter (which is not semantically correct)This change provides a proper, first-class way to pass request metadata while maintaining full backward compatibility.
How Has This Been Tested?
ClientSession.call_toolandClientSessionGroup.call_toolwith_metaparameter_metadata is properly passed through to the underlying request structureBreaking Changes
No breaking changes. The
_metaparameter is optional and defaults toNone, so existing code will continue to work without modification.Types of changes
Checklist
Additional context
RequestParams.Metastructure that was already defined in the types_metaparameter is passed as the_metafield inCallToolRequestParams, which inherits fromRequestParams