Class McpPromptMessage

java.lang.Object
dev.langchain4j.mcp.client.McpPromptMessage

public class McpPromptMessage extends Object
The 'PromptMessage' object from the MCP protocol schema. This can be directly translated to a ChatMessage object from the LangChain4j API.
  • Constructor Details

  • Method Details

    • toChatMessage

      public ChatMessage toChatMessage()
      Converts this MCP-specific PromptMessage representation to a ChatMessage object from the core LangChain4j API, if possible. This is currently not possible if the role is "assistant" AND the content is something other than text.
      Throws:
      UnsupportedOperationException - if the role is 'assistant' and the content is something other than text.
    • role

      public McpRole role()
    • content

      public McpPromptContent content()
    • 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