feat(server): expose progress_callback on ServerSession request methods#2164
Closed
giulio-leone wants to merge 2 commits intomodelcontextprotocol:mainfrom
Closed
feat(server): expose progress_callback on ServerSession request methods#2164giulio-leone wants to merge 2 commits intomodelcontextprotocol:mainfrom
giulio-leone wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
added 2 commits
February 28, 2026 15:41
Add progress_callback parameter to create_message(), elicit_form(), elicit_url(), and the deprecated elicit() wrapper so that server code can receive bidirectional progress notifications from the client during sampling and elicitation requests. BaseSession.send_request() already supports progress_callback, but none of the ServerSession convenience methods forwarded it — callers had no way to pass the parameter without dropping down to send_request(). Closes modelcontextprotocol#1650
Author
|
Closing to reduce noise — focusing on the most impactful PRs. Happy to reopen if there's interest. |
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.
Problem
BaseSession.send_request()supports aprogress_callbackparameter for receiving bidirectional progress notifications, andClientSession.call_tool()already exposes it. However, none of theServerSessionconvenience methods (create_message(),elicit_form(),elicit_url()) forward this parameter, so server code cannot receive progress updates from clients during sampling and elicitation without dropping down to rawsend_request().The TypeScript SDK already exposes this via
RequestOptions.onprogressin bothcreateMessage()andelicitInput().Solution
Add an optional
progress_callback: ProgressFnT | None = Noneparameter (defaulting toNone) to:create_message()(all overloads + implementation)elicit_form()elicit_url()elicit()(deprecated wrapper — passes through toelicit_form())The parameter is forwarded to
send_request().Testing
All 475 server tests pass — the new parameter defaults to
None(no behavioural change for existing callers).Closes #1650