Add notification support
Co-authored-by: Kevin Fischer <kfischer_okarin@yahoo.co.jp>
This commit is contained in:
parent
8fbb2e86aa
commit
55b03fc7aa
1 changed files with 711 additions and 6 deletions
|
|
@ -98,6 +98,30 @@ module MCP
|
|||
@prompts[prompt.name_value] = prompt
|
||||
end
|
||||
|
||||
def notify_tools_list_changed
|
||||
return unless @transport
|
||||
|
||||
@transport.send_notification(Methods::NOTIFICATIONS_TOOLS_LIST_CHANGED)
|
||||
rescue => e
|
||||
report_exception(e, { notification: "tools_list_changed" })
|
||||
end
|
||||
|
||||
def notify_prompts_list_changed
|
||||
return unless @transport
|
||||
|
||||
@transport.send_notification(Methods::NOTIFICATIONS_PROMPTS_LIST_CHANGED)
|
||||
rescue => e
|
||||
report_exception(e, { notification: "prompts_list_changed" })
|
||||
end
|
||||
|
||||
def notify_resources_list_changed
|
||||
return unless @transport
|
||||
|
||||
@transport.send_notification(Methods::NOTIFICATIONS_RESOURCES_LIST_CHANGED)
|
||||
rescue => e
|
||||
report_exception(e, { notification: "resources_list_changed" })
|
||||
end
|
||||
|
||||
def resources_list_handler(&block)
|
||||
@capabilities.support_resources
|
||||
@handlers[Methods::RESOURCES_LIST] = block
|
||||
|
|
|
|||
Loading…
Reference in a new issue