Skip to content

Commit d1e0afa

Browse files
authored
Merge pull request #343 from atesgoral/fix/client-output-schema
fix: preserve client tool output schemas
2 parents 5153c39 + f67cc74 commit d1e0afa

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/mcp/client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def list_tools(cursor: nil)
123123
name: tool["name"],
124124
description: tool["description"],
125125
input_schema: tool["inputSchema"],
126+
output_schema: tool["outputSchema"],
126127
)
127128
end
128129

test/mcp/client_test.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ def test_tools_sends_request_to_transport_and_returns_tools_array
8181
mock_response = {
8282
"result" => {
8383
"tools" => [
84-
{ "name" => "tool1", "description" => "tool1", "inputSchema" => {} },
84+
{
85+
"name" => "tool1",
86+
"description" => "tool1",
87+
"inputSchema" => {},
88+
"outputSchema" => { "type" => "object", "properties" => { "result" => { "type" => "string" } } },
89+
},
8590
{ "name" => "tool2", "description" => "tool2", "inputSchema" => {} },
8691
],
8792
},
@@ -97,7 +102,9 @@ def test_tools_sends_request_to_transport_and_returns_tools_array
97102

98103
assert_equal(2, tools.size)
99104
assert_equal("tool1", tools.first.name)
105+
assert_equal({ "type" => "object", "properties" => { "result" => { "type" => "string" } } }, tools.first.output_schema)
100106
assert_equal("tool2", tools.last.name)
107+
assert_nil(tools.last.output_schema)
101108
end
102109

103110
def test_tools_returns_empty_array_when_no_tools

0 commit comments

Comments
 (0)