McpServer.Prompt.Message (HTTP MCP Server v0.6.0)
View SourceRepresents a single message in a prompt response.
Messages are the building blocks of prompt conversations. Each message has a role (user, assistant, or system) and content.
Fields
role- The role of the message sender ("user", "assistant", or "system")content- The message content (MessageContent struct)
Examples
iex> message = McpServer.Prompt.Message.new(
...> role: "user",
...> content: McpServer.Prompt.MessageContent.new(
...> type: "text",
...> text: "Hello world!"
...> )
...> )
%McpServer.Prompt.Message{
role: "user",
content: %McpServer.Prompt.MessageContent{type: "text", text: "Hello world!"}
}
Summary
Types
@type t() :: %McpServer.Prompt.Message{ content: McpServer.Prompt.MessageContent.t(), role: String.t() }
Functions
Creates a new Prompt.Message struct.
Parameters
opts- Keyword list of message options::role(required) - The role ("user", "assistant", or "system"):content(required) - MessageContent struct
Examples
iex> McpServer.Prompt.Message.new(
...> role: "system",
...> content: McpServer.Prompt.MessageContent.new(
...> type: "text",
...> text: "You are a helpful assistant."
...> )
...> )
%McpServer.Prompt.Message{role: "system", content: %McpServer.Prompt.MessageContent{...}}
iex> McpServer.Prompt.Message.new(
...> role: "user",
...> content: McpServer.Prompt.MessageContent.new(
...> type: "text",
...> text: "What is the weather?"
...> )
...> )
%McpServer.Prompt.Message{role: "user", content: %McpServer.Prompt.MessageContent{...}}