chore: unify tool not found error message

This commit is contained in:
davenpi 2025-05-13 16:54:16 -04:00
commit a6b7da4599
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,7 @@ class ToolManager:
if key in self._tools:
del self._tools[key]
else:
raise NotFoundError(f"Tool {key!r} not found.")
raise NotFoundError(f"Unknown tool: {key}")
async def call_tool(
self, key: str, arguments: dict[str, Any]

View file

@ -117,7 +117,7 @@ class TestAddTools:
def test_remove_tool_missing_key(self):
"""Test removing a tool that does not exist raises NotFoundError."""
manager = ToolManager()
with pytest.raises(NotFoundError, match="Tool 'missing' not found"):
with pytest.raises(NotFoundError, match=f"Unknown tool: {'missing'}"):
manager.remove_tool("missing")
def test_warn_on_duplicate_tools(self, caplog):