Skip to content

Commit dccb29e

Browse files
committed
stop memoizing tools
1 parent 687c2ae commit dccb29e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/mcp/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def initialize(transport:)
2525
attr_reader :transport
2626

2727
# Returns the list of tools available from the server.
28+
# Each call will make a new request – the result is not cached.
2829
#
2930
# @return [Array<MCP::Client::Tool>] An array of available tools.
3031
#
@@ -34,7 +35,7 @@ def initialize(transport:)
3435
# puts tool.name
3536
# end
3637
def tools
37-
@tools ||= transport.tools
38+
transport.tools
3839
end
3940

4041
# Calls a tool via the transport layer.

test/mcp/client_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
module MCP
66
class ClientTest < Minitest::Test
7-
def test_tools_delegates_to_transport_and_caches_result
7+
def test_tools_delegates_to_transport
88
transport = mock
99
mock_tools = [
1010
MCP::Client::Tool.new(name: "tool1", description: "tool1", input_schema: {}),
@@ -13,7 +13,6 @@ def test_tools_delegates_to_transport_and_caches_result
1313
transport.expects(:tools).returns(mock_tools).once
1414
client = Client.new(transport: transport)
1515
assert_equal(mock_tools, client.tools)
16-
assert_equal(mock_tools, client.tools)
1716
end
1817

1918
def test_call_tool_delegates_to_transport

0 commit comments

Comments
 (0)