The MCP spec defines an audio content type, but the SDK only had `Content::Text` and `Content::Image`. Add `Content::Audio` with the same structure as `Content::Image`. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#audio-content
46 lines
1 KiB
Ruby
46 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module MCP
|
|
module Content
|
|
class Text
|
|
attr_reader :text, :annotations
|
|
|
|
def initialize(text, annotations: nil)
|
|
@text = text
|
|
@annotations = annotations
|
|
end
|
|
|
|
def to_h
|
|
{ text: text, annotations: annotations, type: "text" }.compact
|
|
end
|
|
end
|
|
|
|
class Image
|
|
attr_reader :data, :mime_type, :annotations
|
|
|
|
def initialize(data, mime_type, annotations: nil)
|
|
@data = data
|
|
@mime_type = mime_type
|
|
@annotations = annotations
|
|
end
|
|
|
|
def to_h
|
|
{ data: data, mimeType: mime_type, annotations: annotations, type: "image" }.compact
|
|
end
|
|
end
|
|
|
|
class Audio
|
|
attr_reader :data, :mime_type, :annotations
|
|
|
|
def initialize(data, mime_type, annotations: nil)
|
|
@data = data
|
|
@mime_type = mime_type
|
|
@annotations = annotations
|
|
end
|
|
|
|
def to_h
|
|
{ data: data, mimeType: mime_type, annotations: annotations, type: "audio" }.compact
|
|
end
|
|
end
|
|
end
|
|
end
|