Fix method not found error msg for server

Signed-off-by: JermaineHua <crazyhzm@apache.org>
This commit is contained in:
JermaineHua 2025-04-17 22:25:00 +08:00 • committed by Christian Tzolov
commit 41c6bd9af0
2 changed files with 3 additions and 9 deletions

View file

@ -178,7 +178,7 @@ public class McpClientSession implements McpSession {
record MethodNotFoundError(String method, String message, Object data) {
}
public static MethodNotFoundError getMethodNotFoundError(String method) {
private MethodNotFoundError getMethodNotFoundError(String method) {
switch (method) {
case McpSchema.METHOD_ROOTS_LIST:
return new MethodNotFoundError(method, "Roots not supported",

View file

@ -257,14 +257,8 @@ public class McpServerSession implements McpSession {
record MethodNotFoundError(String method, String message, Object data) {
}
static MethodNotFoundError getMethodNotFoundError(String method) {
switch (method) {
case McpSchema.METHOD_ROOTS_LIST:
return new MethodNotFoundError(method, "Roots not supported",
Map.of("reason", "Client does not have roots capability"));
default:
return new MethodNotFoundError(method, "Method not found: " + method, null);
}
private MethodNotFoundError getMethodNotFoundError(String method) {
return new MethodNotFoundError(method, "Method not found: " + method, null);
}
@Override