Class McpLogMessage

java.lang.Object
dev.langchain4j.mcp.client.logging.McpLogMessage

public class McpLogMessage extends Object
  • Constructor Details

  • Method Details

    • fromMap

      public static McpLogMessage fromMap(Map<String,Object> params)
      Parses a McpLogMessage from the contents of the 'params' object inside a 'notifications/message' message, presented as plain values.
    • level

      public McpLogLevel level()
    • logger

      public String logger()
    • dataAsJson

      public String dataAsJson()
      Returns the log payload as JSON text.
    • dataAsMap

      public Map<String,Object> dataAsMap()
      Returns the log payload as a plain map, so consumers do not need a JSON library.
      Returns:
      null when the payload is not a JSON object. MCP allows any JSON-serializable value here and a plain string is common, so use dataAsObject() to read those.
    • dataAsObject

      public Object dataAsObject()
      Returns the log payload as a plain JDK value: a String, a Map, a List, a boxed primitive, or null. MCP defines the payload as any JSON-serializable value, so this is the accessor that can represent all of them.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object