implements the notifications/initialized method
- According to https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle, "After successful initialization, the client MUST send an initialized notification to indicate it is ready to begin normal operations".
This commit is contained in:
parent
541bbe0859
commit
be5e7db2a6
2 changed files with 21 additions and 0 deletions
|
|
@ -74,6 +74,7 @@ module MCP
|
|||
Methods::PROMPTS_GET => method(:get_prompt),
|
||||
Methods::INITIALIZE => method(:init),
|
||||
Methods::PING => ->(_) { {} },
|
||||
Methods::NOTIFICATIONS_INITIALIZED => ->(_) {},
|
||||
|
||||
# No op handlers for currently unsupported methods
|
||||
Methods::RESOURCES_SUBSCRIBE => ->(_) {},
|
||||
|
|
|
|||
|
|
@ -160,6 +160,26 @@ module MCP
|
|||
assert_instrumentation_data({ method: "unsupported_method" })
|
||||
end
|
||||
|
||||
test "#handle notifications/initialized returns nil response" do
|
||||
request = {
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
}
|
||||
|
||||
assert_nil @server.handle(request)
|
||||
assert_instrumentation_data({ method: "notifications/initialized" })
|
||||
end
|
||||
|
||||
test "#handle_json notifications/initialized returns nil response" do
|
||||
request = JSON.generate({
|
||||
jsonrpc: "2.0",
|
||||
method: "notifications/initialized",
|
||||
})
|
||||
|
||||
assert_nil @server.handle_json(request)
|
||||
assert_instrumentation_data({ method: "notifications/initialized" })
|
||||
end
|
||||
|
||||
test "#handle tools/list returns available tools" do
|
||||
request = {
|
||||
jsonrpc: "2.0",
|
||||
|
|
|
|||
Loading…
Reference in a new issue