From 89629b9fd1e3b4aacae7e736770f27bb056f88f5 Mon Sep 17 00:00:00 2001 From: He-Pin Date: Mon, 2 Feb 2026 16:42:48 +0800 Subject: [PATCH] chore: Add @JsonCreator to McpError Signed-off-by: He-Pin --- .../src/main/java/io/modelcontextprotocol/spec/McpError.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mcp-core/src/main/java/io/modelcontextprotocol/spec/McpError.java b/mcp-core/src/main/java/io/modelcontextprotocol/spec/McpError.java index d6e549fdc..2b00ce855 100644 --- a/mcp-core/src/main/java/io/modelcontextprotocol/spec/McpError.java +++ b/mcp-core/src/main/java/io/modelcontextprotocol/spec/McpError.java @@ -4,6 +4,7 @@ package io.modelcontextprotocol.spec; +import com.fasterxml.jackson.annotation.JsonCreator; import io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse.JSONRPCError; import io.modelcontextprotocol.util.Assert; @@ -22,6 +23,10 @@ public class McpError extends RuntimeException { private JSONRPCError jsonRpcError; + /** + * Add @JsonCreator to make sure Jackson can deserialize it properly. + */ + @JsonCreator public McpError(JSONRPCError jsonRpcError) { super(jsonRpcError.message()); this.jsonRpcError = jsonRpcError;