Client request handlers that complete empty send no JSON-RPC response
まだ誰も着手していません。
評価
調査の方向性
McpClientSession と回帰テスト McpClientSessionTests.testEmptyRequestHandlerSendsErrorResponse から始め、MockMcpClientTransport を使用して空のハンドラーのケースを再現します。受信した JSON-RPC リクエストのディスパッチを追跡し、Mono.empty() がリクエスト ID test-id とコード -32603 を持つ 1 つの JSON-RPC エラーレスポンスを生成することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Bug description
When a server sends a request to a Java SDK client, an asynchronous sampling or elicitation handler can return Mono.empty(). McpClientSession then sends no JSON-RPC response, so the server waits until its request timeout.
JSON-RPC 2.0 requires a response for every request with an ID. An empty handler completion should produce an error response with the original request ID.
This is the client-side counterpart to https://github.com/modelcontextprotocol/java-sdk/issues/1081. The open fix at https://github.com/modelcontextprotocol/java-sdk/pull/1099 changes only server-side dispatch paths.
Environment
- Java SDK v2.0.1, commit
c7e1cfe90edcd9cbe030924310a194dc5492eab2 - Java SDK main, commit
39c225e46c51311eaf82192f15b950e421580fb5 - Temurin 25.0.3, compiling with the repository's Java 17 target
Steps to reproduce
Register a client request handler that returns Mono.empty(), then deliver a JSON-RPC request with an ID:
var transport = new MockMcpClientTransport();
var session = new McpClientSession(TIMEOUT, transport,
Map.of("test.method", params -> Mono.empty()), Map.of(), Function.identity());
transport.simulateIncomingMessage(new McpSchema.JSONRPCRequest("test.method", "test-id"));
assertThat(transport.getLastSentMessage()).isInstanceOf(McpSchema.JSONRPCResponse.class);
Both v2.0.1 and main fail because getLastSentMessage() is null:
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Expecting actual not to be null
Expected behavior
The client sends one JSON-RPC error response with ID test-id and code -32603.
Minimal Complete Reproducible example
The regression test is in McpClientSessionTests.testEmptyRequestHandlerSendsErrorResponse.
- 主要言語
- Java
- スター
- 3.7k
- フォーク
- 1.1k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/java-sdk のほかの issue
-
area/transport bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
modelcontextprotocol/java-sdk#1136 ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities オープンbug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/java-sdk#1086 · コメント 1 件 ·
-
enhancement good first issue P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/java-sdk#898 · コメント 1 件 ·
-
documentation P2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
modelcontextprotocol/java-sdk#798 · コメント 1 件 ·
modelcontextprotocol/java-sdk の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
OpenHFT/Chronicle-Map#622 ·
-
Bug Java Platform: Java
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-java#6138 · コメント 1 件 ·
-
bug needs triage p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100