Fix method not found error msg for server
Signed-off-by: JermaineHua <crazyhzm@apache.org>
This commit is contained in:
parent
e4091f458a
commit
41c6bd9af0
2 changed files with 3 additions and 9 deletions
|
|
@ -178,7 +178,7 @@ public class McpClientSession implements McpSession {
|
||||||
record MethodNotFoundError(String method, String message, Object data) {
|
record MethodNotFoundError(String method, String message, Object data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodNotFoundError getMethodNotFoundError(String method) {
|
private MethodNotFoundError getMethodNotFoundError(String method) {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case McpSchema.METHOD_ROOTS_LIST:
|
case McpSchema.METHOD_ROOTS_LIST:
|
||||||
return new MethodNotFoundError(method, "Roots not supported",
|
return new MethodNotFoundError(method, "Roots not supported",
|
||||||
|
|
|
||||||
|
|
@ -257,14 +257,8 @@ public class McpServerSession implements McpSession {
|
||||||
record MethodNotFoundError(String method, String message, Object data) {
|
record MethodNotFoundError(String method, String message, Object data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static MethodNotFoundError getMethodNotFoundError(String method) {
|
private MethodNotFoundError getMethodNotFoundError(String method) {
|
||||||
switch (method) {
|
return new MethodNotFoundError(method, "Method not found: " + method, null);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue