McpServer.Prompt.MessageContent (HTTP MCP Server v0.6.0)

View Source

Represents the content of a prompt message.

Message content can be of various types (text, image, etc.). Currently, text content is the primary supported type.

Fields

  • type - The content type ("text", "image", etc.)
  • text - The text content (for text type)
  • Additional fields can be added for other content types

Examples

iex> content = McpServer.Prompt.MessageContent.new(
...>   type: "text",
...>   text: "Hello world!"
...> )
%McpServer.Prompt.MessageContent{
  type: "text",
  text: "Hello world!"
}

Summary

Functions

Creates a new Prompt.MessageContent struct.

Types

t()

@type t() :: %McpServer.Prompt.MessageContent{
  text: String.t() | nil,
  type: String.t()
}

Functions

new(opts)

@spec new(keyword()) :: t()

Creates a new Prompt.MessageContent struct.

Parameters

  • opts - Keyword list of content options:
    • :type (required) - The content type
    • :text - The text content (for text type)

Examples

iex> McpServer.Prompt.MessageContent.new(
...>   type: "text",
...>   text: "This is a text message"
...> )
%McpServer.Prompt.MessageContent{
  type: "text",
  text: "This is a text message"
}

iex> McpServer.Prompt.MessageContent.new(type: "text")
%McpServer.Prompt.MessageContent{type: "text", text: nil}