feat(mcp): forward progress_callback to ClientSession.call_tool#2114
Open
davidbolvansky-invicti wants to merge 1 commit intostrands-agents:mainfrom
Open
feat(mcp): forward progress_callback to ClientSession.call_tool#2114davidbolvansky-invicti wants to merge 1 commit intostrands-agents:mainfrom
davidbolvansky-invicti wants to merge 1 commit intostrands-agents:mainfrom
Conversation
Add progress_callback parameter to call_tool_sync, call_tool_async, and _create_call_tool_coroutine. When provided, the MCP SDK automatically includes a progressToken in the request metadata, enabling MCP servers to send progress notifications via ctx.report_progress(). This is essential for long-running tool calls (e.g. crawls, agent orchestration) where progress data keeps the HTTP/SSE connection alive and provides observability. Closes strands-agents#1812
|
Hello @davidbolvansky-invicti , you mentioned this closes my issue #1812 . But does it? Your PR mentions
but #1812 is about tasks, not just regular Tool Call progress updates. Can you please give a code example to use this with a Task and polling? I think this line should call the callback instead of no-op, no? |
Author
|
Yes, you are right, this will not fix that MR. I had it in mind as something related, but my goal is to fix call tool progress reporting as I would like to use as downstream consumer of this Strands SDK. |
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.
Summary
Forward the
progress_callbackparameter fromMCPClient.call_tool_sync/call_tool_asyncthrough to the underlyingClientSession.call_tool().When a
progress_callbackis provided, the MCP SDK automatically includes aprogressTokenin the request metadata, enabling MCP servers to sendnotifications/progressviactx.report_progress(). Without this passthrough,ctx.report_progress()silently no-ops because no token is present.This is essential for long-running MCP tools (crawls, orchestration waits) where:
Changes
progress_callback: ProgressFnT | None = Noneparameter to_create_call_tool_coroutine,call_tool_sync, andcall_tool_asyncprogress_callbacktoClientSession.call_tool()in the direct (non-task) execution pathPattern
This follows the exact same pattern as the
metaparameter added in #1918 — one parameter passthrough per method, fully backwards-compatible.