McpServer.Tool.Content.Audio (HTTP MCP Server v0.9.0)

View Source

Represents audio content in a tool result.

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

Fields

  • data - The raw binary audio data (required)
  • mime_type - The MIME type of the audio (required, e.g., "audio/wav", "audio/mpeg", "audio/ogg")

Examples

iex> audio_data = <<0, 1, 2, 3>>
iex> audio = McpServer.Tool.Content.Audio.new(data: audio_data, mime_type: "audio/wav")
iex> audio.mime_type
"audio/wav"

Summary

Functions

Creates a new Audio content struct.

Types

t()

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

Functions

new(opts)

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

Creates a new Audio content struct.

Parameters

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

Examples

iex> audio_data = <<0, 1, 2, 3>>
iex> McpServer.Tool.Content.Audio.new(data: audio_data, mime_type: "audio/wav")
%McpServer.Tool.Content.Audio{data: <<0, 1, 2, 3>>, mime_type: "audio/wav"}