Nicer error API
Both the combination of positional argument and naming does not feel like Ruby. This change makes `is_error` argument a keyword argument called `error`. Thanks to this, the usage is more self-explanatory: ```ruby response = Response.new([], error: true) ```
This commit is contained in:
parent
33258623a7
commit
6689db2ca0
1 changed files with 94 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ module MCP
|
|||
tool = TestTool
|
||||
response = tool.call(message: "test")
|
||||
assert_equal response.content, [{ type: "text", content: "OK" }]
|
||||
assert_equal response.is_error, false
|
||||
refute response.error?
|
||||
end
|
||||
|
||||
test "allows declarative definition of tools as classes" do
|
||||
|
|
@ -250,7 +250,7 @@ module MCP
|
|||
tool = TypedTestTool
|
||||
response = tool.call(message: "test")
|
||||
assert_equal response.content, [{ type: "text", content: "OK" }]
|
||||
assert_equal response.is_error, false
|
||||
refute response.error?
|
||||
end
|
||||
|
||||
class TestToolWithoutServerContext < Tool
|
||||
|
|
|
|||
Loading…
Reference in a new issue