Class JacksonMcpJsonMapper
java.lang.Object
io.modelcontextprotocol.json.jackson3.JacksonMcpJsonMapper
- All Implemented Interfaces:
McpJsonMapper
Jackson-based implementation of JsonMapper. Wraps a Jackson JsonMapper but keeps the
SDK decoupled from Jackson at the API level.
-
Constructor Summary
ConstructorsConstructorDescriptionJacksonMcpJsonMapper(tools.jackson.databind.json.JsonMapper jsonMapper) Constructs a new JacksonMcpJsonMapper instance with the given JsonMapper. -
Method Summary
Modifier and TypeMethodDescription<T> TconvertValue(Object fromValue, TypeRef<T> type) <T> TconvertValue(Object fromValue, Class<T> type) tools.jackson.databind.json.JsonMapperReturns the underlying JacksonJsonMapperused for JSON serialization and deserialization.<T> T<T> T<T> T<T> Tbyte[]writeValueAsBytes(Object value) writeValueAsString(Object value)
-
Constructor Details
-
JacksonMcpJsonMapper
public JacksonMcpJsonMapper(tools.jackson.databind.json.JsonMapper jsonMapper) Constructs a new JacksonMcpJsonMapper instance with the given JsonMapper.- Parameters:
jsonMapper- the JsonMapper to be used for JSON serialization and deserialization. Must not be null.- Throws:
IllegalArgumentException- if the provided JsonMapper is null.
-
-
Method Details
-
getJsonMapper
public tools.jackson.databind.json.JsonMapper getJsonMapper()Returns the underlying JacksonJsonMapperused for JSON serialization and deserialization.- Returns:
- the JsonMapper 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
-