Class: RubyLLM::MCP::Progress

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/mcp/progress.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(coordinator, progress_handler, progress_data) ⇒ Progress

Returns a new instance of Progress.



8
9
10
11
12
13
14
15
16
17
# File 'lib/ruby_llm/mcp/progress.rb', line 8

def initialize(coordinator, progress_handler, progress_data)
  @coordinator = coordinator
  @client = coordinator.client
  @progress_handler = progress_handler

  @progress_token = progress_data["progressToken"]
  @progress = progress_data["progress"]
  @total = progress_data["total"]
  @message = progress_data["message"]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/ruby_llm/mcp/progress.rb', line 6

def client
  @client
end

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/ruby_llm/mcp/progress.rb', line 6

def message
  @message
end

#progressObject (readonly)

Returns the value of attribute progress.



6
7
8
# File 'lib/ruby_llm/mcp/progress.rb', line 6

def progress
  @progress
end

#progress_tokenObject (readonly)

Returns the value of attribute progress_token.



6
7
8
# File 'lib/ruby_llm/mcp/progress.rb', line 6

def progress_token
  @progress_token
end

#totalObject (readonly)

Returns the value of attribute total.



6
7
8
# File 'lib/ruby_llm/mcp/progress.rb', line 6

def total
  @total
end

Instance Method Details

#execute_progress_handlerObject



19
20
21
# File 'lib/ruby_llm/mcp/progress.rb', line 19

def execute_progress_handler
  @progress_handler.call(self)
end

#to_hObject Also known as: to_json



23
24
25
26
27
28
29
30
# File 'lib/ruby_llm/mcp/progress.rb', line 23

def to_h
  {
    progress_token: @progress_token,
    progress: @progress,
    total: @total,
    message: @message
  }
end