fix(tools): validate arguments with jsonschema without coercion (#6648)
Co-authored-by: xiong-wei1 <2318942410@qq.com>
This commit is contained in:
1 parent
25ed91ffeb
commit
8cce73465b
27 files changed
+689
-614
No files matched your search
@@ -100,3 +100,15 @@ class TestSchemaSelfDescribesRequirements:
|
||||
# accidentally introduced).
|
||||
tool = CronTool(_SvcStub())
|
||||
assert tool.parameters["required"] == ["action"]
|
||||
|
||||
|
||||
async def test_invalid_action_returns_tool_error_and_allows_correction(registry):
|
||||
from nanobot.agent.tools.registry import is_tool_error_result
|
||||
|
||||
arguments = {"action": ["list"]}
|
||||
result = await registry.execute("cron", arguments)
|
||||
|
||||
assert is_tool_error_result(result)
|
||||
assert "action:" in result and "string" in result
|
||||
assert arguments == {"action": ["list"]}
|
||||
assert await registry.execute("cron", {"action": "list"}) == "No scheduled jobs."
|
||||
Reference in new issue
Block a user