Skip to content

Commit 50ad8c8

Browse files
committed
return all responses, not just text property of first one
1 parent 5168003 commit 50ad8c8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/mcp/client/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def call_tool(tool:, input:)
2525
params: { name: tool.name, arguments: input },
2626
).body
2727

28-
response.dig("result", "content", 0, "text")
28+
response.dig("result", "content")
2929
end
3030

3131
private

test/mcp/client/http_test.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,18 @@ def test_call_tool_returns_tool_response
156156
{
157157
text: "Tool response",
158158
},
159+
{
160+
custom_property: "woah, something different",
161+
},
159162
],
160163
},
161164
}.to_json,
162165
)
163166

164167
response = client.call_tool(tool: tool, input: input)
165-
assert_equal("Tool response", response)
168+
assert_equal(2, response.size)
169+
assert_equal("Tool response", response.dig(0, "text"))
170+
assert_equal("woah, something different", response.dig(1, "custom_property"))
166171
end
167172

168173
def test_call_tool_handles_empty_response
@@ -210,7 +215,7 @@ def test_call_tool_handles_empty_response
210215
)
211216

212217
response = client.call_tool(tool: tool, input: input)
213-
assert_nil(response)
218+
assert_empty(response)
214219
end
215220

216221
def test_raises_bad_request_error

0 commit comments

Comments
 (0)