Class: RubyLLM::MCP::NotificationHandler
- Inherits:
-
Object
- Object
- RubyLLM::MCP::NotificationHandler
- Defined in:
- lib/ruby_llm/mcp/notification_handler.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #execute(notification) ⇒ Object
-
#initialize(client) ⇒ NotificationHandler
constructor
A new instance of NotificationHandler.
Constructor Details
#initialize(client) ⇒ NotificationHandler
Returns a new instance of NotificationHandler.
8 9 10 |
# File 'lib/ruby_llm/mcp/notification_handler.rb', line 8 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/ruby_llm/mcp/notification_handler.rb', line 6 def client @client end |
Instance Method Details
#execute(notification) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ruby_llm/mcp/notification_handler.rb', line 12 def execute(notification) case notification.type when "notifications/tools/list_changed" client.reset_tools! when "notifications/resources/list_changed" client.reset_resources! when "notifications/resources/updated" process_resource_updated(notification) when "notifications/prompts/list_changed" client.reset_prompts! when "notifications/message" (notification) when "notifications/progress" (notification) when "notifications/cancelled" process_cancelled_notification(notification) when "notifications/tasks/status" process_task_status_notification(notification) when "notifications/elicitation/complete" process_elicitation_complete_notification(notification) else process_unknown_notification(notification) end end |