Skip to content

Commit 485d4f8

Browse files
committed
chore: Add @JsonCreator to McpError
Signed-off-by: He-Pin <hepin1989@gmail.com>
1 parent 4fe8f3e commit 485d4f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpError.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package io.modelcontextprotocol.spec;
66

7+
import com.fasterxml.jackson.annotation.JsonCreator;
78
import io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse.JSONRPCError;
89
import io.modelcontextprotocol.util.Assert;
910

@@ -22,6 +23,10 @@ public class McpError extends RuntimeException {
2223

2324
private JSONRPCError jsonRpcError;
2425

26+
/**
27+
* Add @JsonCreator to make sure Jackson can deserialize it properly.
28+
* */
29+
@JsonCreator
2530
public McpError(JSONRPCError jsonRpcError) {
2631
super(jsonRpcError.message());
2732
this.jsonRpcError = jsonRpcError;

0 commit comments

Comments
 (0)