Skip to content

Commit 55e07f6

Browse files
committed
patch up some suggestions
- use pattern matching - remove typed: false from tools
1 parent 03c492d commit 55e07f6

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/mcp/client/tool.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# typed: false
21
# frozen_string_literal: true
32

43
module MCP

test/mcp/client_test.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def test_tools_sends_request_to_transport_and_returns_tools_array
1818

1919
# Only checking for the essential parts of the request
2020
transport.expects(:send_request).with do |args|
21-
args.dig(:request, :method) == "tools/list" &&
22-
args.dig(:request, :jsonrpc) == "2.0"
21+
args in { request: { method: "tools/list", jsonrpc: "2.0" } }
2322
end.returns(mock_response).once
2423

2524
client = Client.new(transport: transport)
@@ -40,10 +39,16 @@ def test_call_tool_sends_request_to_transport_and_returns_content
4039

4140
# Only checking for the essential parts of the request
4241
transport.expects(:send_request).with do |args|
43-
args.dig(:request, :method) == "tools/call" &&
44-
args.dig(:request, :jsonrpc) == "2.0" &&
45-
args.dig(:request, :params, :name) == "tool1" &&
46-
args.dig(:request, :params, :arguments) == arguments
42+
args in {
43+
request: {
44+
method: "tools/call",
45+
jsonrpc: "2.0",
46+
params: {
47+
name: "tool1",
48+
arguments: arguments,
49+
},
50+
},
51+
}
4752
end.returns(mock_response).once
4853

4954
client = Client.new(transport: transport)

0 commit comments

Comments
 (0)