forked from modelcontextprotocol/ruby-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontent.rb
More file actions
63 lines (51 loc) · 1.52 KB
/
content.rb
File metadata and controls
63 lines (51 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# frozen_string_literal: true
module MCP
module Content
class Text
attr_reader :text, :annotations, :meta
def initialize(text, annotations: nil, meta: nil)
@text = text
@annotations = annotations
@meta = meta
end
def to_h
{ text: text, annotations: annotations, _meta: meta, type: "text" }.compact
end
end
class Image
attr_reader :data, :mime_type, :annotations, :meta
def initialize(data, mime_type, annotations: nil, meta: nil)
@data = data
@mime_type = mime_type
@annotations = annotations
@meta = meta
end
def to_h
{ data: data, mimeType: mime_type, annotations: annotations, _meta: meta, type: "image" }.compact
end
end
class Audio
attr_reader :data, :mime_type, :annotations, :meta
def initialize(data, mime_type, annotations: nil, meta: nil)
@data = data
@mime_type = mime_type
@annotations = annotations
@meta = meta
end
def to_h
{ data: data, mimeType: mime_type, annotations: annotations, _meta: meta, type: "audio" }.compact
end
end
class EmbeddedResource
attr_reader :resource, :annotations, :meta
def initialize(resource, annotations: nil, meta: nil)
@resource = resource
@annotations = annotations
@meta = meta
end
def to_h
{ resource: resource.to_h, annotations: annotations, _meta: meta, type: "resource" }.compact
end
end
end
end