Add logging support
A server can send structured logging messages to the client. https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/logging#logging Logging was specified in the 2024-11-05 specification, but since it was not supported in ruby-sdk, I implemented it. https://modelcontextprotocol.io/specification/2024-11-05/server/utilities/logging I also made it possible to output a simple notification message in the examples.
This commit is contained in:
parent
830913be5a
commit
afa2fb4077
1 changed files with 434 additions and 7 deletions
|
|
@ -122,6 +122,10 @@ def main
|
|||
exit(1)
|
||||
end
|
||||
|
||||
if init_response[:body].dig("result", "capabilities", "logging")
|
||||
make_request(session_id, "logging/setLevel", { level: "info" })
|
||||
end
|
||||
|
||||
logger.info("Session initialized: #{session_id}")
|
||||
logger.info("Server info: #{init_response[:body]["result"]["serverInfo"]}")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue