Add Content::Audio class for audio content type
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
This commit is contained in:
parent
76ab822ad7
commit
cbb81a836c
1 changed files with 39 additions and 0 deletions
|
|
@ -28,5 +28,19 @@ module MCP
|
|||
{ 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue