Class McpOperationHandler

java.lang.Object
dev.langchain4j.mcp.client.transport.McpOperationHandler

public class McpOperationHandler extends Object
Handles incoming messages from the MCP server. Transport implementations should call the "handle" method on each received message. A transport also has to call "startOperation" when before starting an operation that requires a response to register its ID in the map of pending operations.
  • Constructor Details

    • McpOperationHandler

      public McpOperationHandler(Map<Long,CompletableFuture<com.fasterxml.jackson.databind.JsonNode>> pendingOperations)
  • Method Details

    • handle

      public void handle(com.fasterxml.jackson.databind.JsonNode message)
    • startOperation

      public void startOperation(Long id, CompletableFuture<com.fasterxml.jackson.databind.JsonNode> future)