Class: MCP::Prompt::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/mcp/prompt/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role:, content:) ⇒ Message



8
9
10
11
# File 'lib/mcp/prompt/message.rb', line 8

def initialize(role:, content:)
  @role = role
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/mcp/prompt/message.rb', line 6

def content
  @content
end

#roleObject (readonly)

Returns the value of attribute role.



6
7
8
# File 'lib/mcp/prompt/message.rb', line 6

def role
  @role
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/mcp/prompt/message.rb', line 13

def to_h
  { role:, content: content.to_h }.compact
end