Class McpJson
java.lang.Object
dev.langchain4j.mcp.client.transport.McpJson
Bridges between JSON text and Jackson's tree model while both the
deprecated
JsonNode-based transport API and its replacement coexist.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TRe-reads an already-decoded JSON value as the given type.static <T> List<T> convertList(Object value, Class<T> elementType) Re-reads an already-decoded JSON array as a list of the given element type.static <T> Tdeserialize(com.fasterxml.jackson.databind.JsonNode message, Class<T> type) Deserializes an MCP message into a protocol type.static <T,R> CompletableFuture <R> map(CompletableFuture<T> source, Function<T, R> mapper) Maps a future's value while keeping cancellation linked to the source.static com.fasterxml.jackson.databind.JsonNodestatic StringSerializes an outbound MCP message.Reads a JSON object as plain values.static Object
-
Method Details
-
deserialize
Deserializes an MCP message into a protocol type. -
toValue
- Throws:
IllegalArgumentException- if the text is not valid JSON.
-
toMap
-
convert
-
convertList
-
serialize
-
parse
-
map
Maps a future's value while keeping cancellation linked to the source. A plainthenApplywould not propagate cancellation upstream, which would leave the transport's response stream open after the client cancels the operation.
-