Merge pull request #343 from atesgoral/fix/client-output-schema
fix: preserve client tool output schemas
This commit is contained in:
commit
d1e0afa158
2 changed files with 9 additions and 1 deletions
|
|
@ -123,6 +123,7 @@ module MCP
|
||||||
name: tool["name"],
|
name: tool["name"],
|
||||||
description: tool["description"],
|
description: tool["description"],
|
||||||
input_schema: tool["inputSchema"],
|
input_schema: tool["inputSchema"],
|
||||||
|
output_schema: tool["outputSchema"],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,12 @@ module MCP
|
||||||
mock_response = {
|
mock_response = {
|
||||||
"result" => {
|
"result" => {
|
||||||
"tools" => [
|
"tools" => [
|
||||||
{ "name" => "tool1", "description" => "tool1", "inputSchema" => {} },
|
{
|
||||||
|
"name" => "tool1",
|
||||||
|
"description" => "tool1",
|
||||||
|
"inputSchema" => {},
|
||||||
|
"outputSchema" => { "type" => "object", "properties" => { "result" => { "type" => "string" } } },
|
||||||
|
},
|
||||||
{ "name" => "tool2", "description" => "tool2", "inputSchema" => {} },
|
{ "name" => "tool2", "description" => "tool2", "inputSchema" => {} },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -97,7 +102,9 @@ module MCP
|
||||||
|
|
||||||
assert_equal(2, tools.size)
|
assert_equal(2, tools.size)
|
||||||
assert_equal("tool1", tools.first.name)
|
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_equal("tool2", tools.last.name)
|
||||||
|
assert_nil(tools.last.output_schema)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_tools_returns_empty_array_when_no_tools
|
def test_tools_returns_empty_array_when_no_tools
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue