McpServer.Tool.Content.Image (HTTP MCP Server v0.6.0)

View Source

Represents image content in a tool result.

The image data is stored as-is (not base64-encoded in the struct). Base64 encoding happens during JSON serialization.

Fields

  • data - The raw binary image data (required)
  • mime_type - The MIME type of the image (required)

Examples

iex> image_data = <<137, 80, 78, 71>>
iex> image = McpServer.Tool.Content.Image.new(data: image_data, mime_type: "image/png")
iex> image.mime_type
"image/png"

Summary

Functions

Creates a new Image content struct.

Types

t()

@type t() :: %McpServer.Tool.Content.Image{data: binary(), mime_type: String.t()}

Functions

new(opts)

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

Creates a new Image content struct.

Parameters

  • opts - Keyword list with required :data and :mime_type fields

Examples

iex> image_data = <<255, 216, 255>>
iex> McpServer.Tool.Content.Image.new(data: image_data, mime_type: "image/jpeg")
%McpServer.Tool.Content.Image{data: <<255, 216, 255>>, mime_type: "image/jpeg"}