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

Returns a new instance of Message.



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

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

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#roleObject (readonly)

Returns the value of attribute role.



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

def role
  @role
end

Instance Method Details

#to_hObject



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

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