Skip to content

Commit 41c6bd9

Browse files
CrazyHZMtzolov
authored andcommitted
Fix method not found error msg for server
Signed-off-by: JermaineHua <[email protected]>
1 parent e4091f4 commit 41c6bd9

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

mcp/src/main/java/io/modelcontextprotocol/spec/McpClientSession.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private Mono<McpSchema.JSONRPCResponse> handleIncomingRequest(McpSchema.JSONRPCR
178178
record MethodNotFoundError(String method, String message, Object data) {
179179
}
180180

181-
public static MethodNotFoundError getMethodNotFoundError(String method) {
181+
private MethodNotFoundError getMethodNotFoundError(String method) {
182182
switch (method) {
183183
case McpSchema.METHOD_ROOTS_LIST:
184184
return new MethodNotFoundError(method, "Roots not supported",

mcp/src/main/java/io/modelcontextprotocol/spec/McpServerSession.java

+2-8
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,8 @@ private Mono<Void> handleIncomingNotification(McpSchema.JSONRPCNotification noti
257257
record MethodNotFoundError(String method, String message, Object data) {
258258
}
259259

260-
static MethodNotFoundError getMethodNotFoundError(String method) {
261-
switch (method) {
262-
case McpSchema.METHOD_ROOTS_LIST:
263-
return new MethodNotFoundError(method, "Roots not supported",
264-
Map.of("reason", "Client does not have roots capability"));
265-
default:
266-
return new MethodNotFoundError(method, "Method not found: " + method, null);
267-
}
260+
private MethodNotFoundError getMethodNotFoundError(String method) {
261+
return new MethodNotFoundError(method, "Method not found: " + method, null);
268262
}
269263

270264
@Override

0 commit comments

Comments
 (0)