π The fast, Pythonic way to build MCP servers and clients.
chore: unify tool not found error message
davenpia6b7da45993d
diff --git a/src/fastmcp/tools/tool_manager.py b/src/fastmcp/tools/tool_manager.pyindex 3114fa1ae..509f4e6de 100644--- a/src/fastmcp/tools/tool_manager.py+++ b/src/fastmcp/tools/tool_manager.py@@ -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]diff --git a/tests/tools/test_tool_manager.py b/tests/tools/test_tool_manager.pyindex 4d61d0520..9d35d177f 100644--- a/tests/tools/test_tool_manager.py+++ b/tests/tools/test_tool_manager.py@@ -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):