Class JacksonMcpJsonMapper
java.lang.Object
io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapper
- All Implemented Interfaces:
McpJsonMapper
Jackson-based implementation of JsonMapper. Wraps a Jackson ObjectMapper but keeps the
SDK decoupled from Jackson at the API level.
-
Constructor Summary
ConstructorsConstructorDescriptionJacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper. -
Method Summary
Modifier and TypeMethodDescription<T> TconvertValue(Object fromValue, TypeRef<T> type) <T> TconvertValue(Object fromValue, Class<T> type) com.fasterxml.jackson.databind.ObjectMapperReturns the underlying JacksonObjectMapperused for JSON serialization and deserialization.<T> T<T> T<T> T<T> Tbyte[]writeValueAsBytes(Object value) writeValueAsString(Object value)
-
Constructor Details
-
JacksonMcpJsonMapper
public JacksonMcpJsonMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper.- Parameters:
objectMapper- the ObjectMapper to be used for JSON serialization and deserialization. Must not be null.- Throws:
IllegalArgumentException- if the provided ObjectMapper is null.
-
-
Method Details
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()Returns the underlying JacksonObjectMapperused for JSON serialization and deserialization.- Returns:
- the ObjectMapper instance
-
readValue
- Specified by:
readValuein interfaceMcpJsonMapper- Throws:
IOException
-
readValue
- Specified by:
readValuein interfaceMcpJsonMapper- Throws:
IOException
-
readValue
- Specified by:
readValuein interfaceMcpJsonMapper- Throws:
IOException
-
readValue
- Specified by:
readValuein interfaceMcpJsonMapper- Throws:
IOException
-
convertValue
- Specified by:
convertValuein interfaceMcpJsonMapper
-
convertValue
- Specified by:
convertValuein interfaceMcpJsonMapper
-
writeValueAsString
- Specified by:
writeValueAsStringin interfaceMcpJsonMapper- Throws:
IOException
-
writeValueAsBytes
- Specified by:
writeValueAsBytesin interfaceMcpJsonMapper- Throws:
IOException
-