modelcontextprotocol / modelcontextprotocol/python-sdk
ServerSession methods (create_message, elicit_form) don't expose progress_callback parameter
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 24.3k
- フォーク
- 4k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 31
説明
Summary
The ServerSession high-level methods for sending requests to clients (create_message, elicit_form) don't expose the progress_callback parameter, even though the underlying BaseSession.send_request() fully supports it.
This means servers can't easily receive progress notifications from clients during sampling or elicitation requests.
Current Behavior
# ServerSession.elicit_form() - no progress_callback parameter
async def elicit_form(
self,
message: str,
requestedSchema: types.ElicitRequestedSchema,
related_request_id: types.RequestId | None = None,
) -> types.ElicitResult:
return await self.send_request(...) # progress_callback not passed through
# ServerSession.create_message() - same issue
async def create_message(
self,
messages: list[types.SamplingMessage],
*,
max_tokens: int,
# ... other params ...
related_request_id: types.RequestId | None = None,
) -> types.CreateMessageResult:
return await self.send_request(...) # progress_callback not passed through
Expected Behavior
# Should be able to pass progress_callback
result = await server_session.elicit_form(
message="Please provide your details",
requestedSchema=schema,
progress_callback=lambda progress, total, msg: print(f"Progress: {progress}/{total} - {msg}")
)
result = await server_session.create_message(
messages=messages,
max_tokens=1000,
progress_callback=lambda progress, total, msg: print(f"Sampling progress: {progress}/{total}")
)
Context
- The MCP spec supports bidirectional progress notifications - clients CAN send
notifications/progressback to servers during request handling BaseSession.send_request()already supportsprogress_callbackparameterClientSession.call_tool()exposesprogress_callbackfor the client→server direction- The TypeScript SDK exposes this via
RequestOptions.onprogressin bothcreateMessage()andelicitInput() - Tests in
tests/shared/test_progress_notifications.pydemonstrate the bidirectional flow works
Suggested Fix
Add progress_callback: ProgressFnT | None = None parameter to:
ServerSession.create_message()ServerSession.elicit_form()- Any other
ServerSessionmethods that send requests to clients
And pass it through to send_request().
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ServerSession.create_message() と elicit_form() のエントリポイントから始め、次にそれらの呼び出しを BaseSession.send_request() および既存の進捗コールバック処理と比較します。tests/shared/test_progress_notifications.py を確認し、両方のメソッドが progress_callback を受け付けて転送し、双方向フローのカバレッジがある状態を作業完了とみなします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 72/100