Merge pull request #343 from atesgoral/fix/client-output-schema

fix: preserve client tool output schemas
This commit is contained in:
Koichi ITO 2026-05-13 01:21:37 +09:00 • committed by GitHub
commit d1e0afa158
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -123,6 +123,7 @@ module MCP
name: tool["name"],
description: tool["description"],
input_schema: tool["inputSchema"],
output_schema: tool["outputSchema"],
)
end

View file

@ -81,7 +81,12 @@ module MCP
mock_response = {
"result" => {
"tools" => [
{ "name" => "tool1", "description" => "tool1", "inputSchema" => {} },
{
"name" => "tool1",
"description" => "tool1",
"inputSchema" => {},
"outputSchema" => { "type" => "object", "properties" => { "result" => { "type" => "string" } } },
},
{ "name" => "tool2", "description" => "tool2", "inputSchema" => {} },
],
},
@ -97,7 +102,9 @@ module MCP
assert_equal(2, tools.size)
assert_equal("tool1", tools.first.name)
assert_equal({ "type" => "object", "properties" => { "result" => { "type" => "string" } } }, tools.first.output_schema)
assert_equal("tool2", tools.last.name)
assert_nil(tools.last.output_schema)
end
def test_tools_returns_empty_array_when_no_tools