Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Client request handlers that complete empty send no JSON-RPC response

Đang mở Phù hợp với người mới
#1,124 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với McpClientSession và bài kiểm thử hồi quy McpClientSessionTests.testEmptyRequestHandlerSendsErrorResponse, sử dụng MockMcpClientTransport để tái hiện trường hợp handler rỗng. Theo dõi việc phân phối các yêu cầu JSON-RPC đến và xác minh rằng Mono.empty() tạo ra một phản hồi lỗi JSON-RPC với ID yêu cầu test-id và mã -32603.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area/client bug P2

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.

Ngôn ngữ chính
Java
Star
3.7k
Fork
1.1k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/java-sdk

Tất cả issue của modelcontextprotocol/java-sdk

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.