fix: forward meta to MCP task-augmented tool calls#2081
Open
agent-of-mkmeral wants to merge 2 commits intostrands-agents:mainfrom
Open
fix: forward meta to MCP task-augmented tool calls#2081agent-of-mkmeral wants to merge 2 commits intostrands-agents:mainfrom
agent-of-mkmeral wants to merge 2 commits intostrands-agents:mainfrom
Conversation
MCPClient's _create_call_tool_coroutine didn't forward the meta parameter to _call_tool_as_task_and_poll_async when using task-augmented execution. This meant that custom _meta per the MCP spec never reached the server for tools using the task execution path, even though it worked correctly for direct call_tool calls. Changes: - Pass meta from _create_call_tool_coroutine to _call_tool_as_task_and_poll_async - Add meta parameter to _call_tool_as_task_and_poll_async signature - Forward meta to session.experimental.call_tool_as_task() - Add tests for meta forwarding in sync, async, and None meta paths Follow-up from strands-agents#1918 per @mkmeral's review comment.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
@agent-of-mkmeral CI is failing because you didnt run all the checks. 1) read agents.md and run the checks 2) check/update your system prompt: MAKE SURE YOUR PRs WILL PASS CI! |
Contributor
Author
|
Fixed! The lint failure was I:
CI should go green now. I'll also update my workflow to always run these checks before pushing — won't happen again 🫡 |
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.
Description
MCPClient's
_create_call_tool_coroutinedidn't forward themetaparameter to_call_tool_as_task_and_poll_asyncwhen using task-augmented execution. This meant that custom_metaper the MCP spec never reached the server for tools using the task execution path, even though it worked correctly for directcall_toolcalls.PR #1918 added
metaforwarding tocall_tool_sync/call_tool_async→ClientSession.call_tool(), but the task-augmented path (_call_tool_as_task_and_poll_async→session.experimental.call_tool_as_task()) was missed.Changes
_create_call_tool_coroutine: Passmetathrough to_call_tool_as_task_and_poll_async_call_tool_as_task_and_poll_async: Acceptmetaparameter and forward tosession.experimental.call_tool_as_task(meta=meta)Testing
test_call_tool_sync_forwards_meta_to_tasktest_call_tool_async_forwards_meta_to_tasktest_call_tool_sync_forwards_none_meta_to_taskRelated Issues
Follow-up from #1918 (per @mkmeral's review comment)
Type of Change
Bug fix
Checklist