From 25f3f9a33ad632cccf88adb59646d94073c4e98a Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 9 May 2026 19:12:37 +0900 Subject: [PATCH] Use `Server#tools` instead of `instance_variable_get` Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/301#discussion_r3046699277. `Server#tools` method can be used instead of a hack like `instance_variable_get(:@tools)`. --- test/mcp/server_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mcp/server_test.rb b/test/mcp/server_test.rb index b2e0b2d9..a8f3ea0d 100644 --- a/test/mcp/server_test.rb +++ b/test/mcp/server_test.rb @@ -1390,7 +1390,7 @@ class Example < Tool Tool::Response.new({ "response" => message }) end - stored_tool = @server.instance_variable_get(:@tools)["defined_tool"] + stored_tool = @server.tools["defined_tool"] assert_not_nil(stored_tool) assert_equal(MCP::Tool::OutputSchema.new({ type: "object", properties: { response: { type: "string" } }, required: ["response"] }), stored_tool.output_schema)