Skip to content

Commit 687c2ae

Browse files
committed
simple client test
1 parent d097729 commit 687c2ae

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/mcp/client_test.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44

55
module MCP
66
class ClientTest < Minitest::Test
7-
# no functionality to test yet
7+
def test_tools_delegates_to_transport_and_caches_result
8+
transport = mock
9+
mock_tools = [
10+
MCP::Client::Tool.new(name: "tool1", description: "tool1", input_schema: {}),
11+
MCP::Client::Tool.new(name: "tool2", description: "tool2", input_schema: {}),
12+
]
13+
transport.expects(:tools).returns(mock_tools).once
14+
client = Client.new(transport: transport)
15+
assert_equal(mock_tools, client.tools)
16+
assert_equal(mock_tools, client.tools)
17+
end
18+
19+
def test_call_tool_delegates_to_transport
20+
transport = mock
21+
tool = MCP::Client::Tool.new(name: "tool1", description: "tool1", input_schema: {})
22+
transport.expects(:call_tool).with(tool: tool, input: { foo: "bar" }).returns("result")
23+
client = Client.new(transport: transport)
24+
assert_equal("result", client.call_tool(tool: tool, input: { foo: "bar" }))
25+
end
826
end
927
end

0 commit comments

Comments
 (0)