diff --git a/astrbot/_internal/tools/base.py b/astrbot/_internal/tools/base.py index 6f8f1f57b..56e342799 100644 --- a/astrbot/_internal/tools/base.py +++ b/astrbot/_internal/tools/base.py @@ -100,6 +100,10 @@ class ToolSet: """Add a tool to the set.""" self._tools[tool.name] = tool + def add_tool(self, tool: FunctionTool) -> None: + """Add a tool to the set (alias for add()).""" + self.add(tool) + def remove(self, name: str) -> FunctionTool | None: """Remove and return a tool by name.""" return self._tools.pop(name, None) @@ -126,6 +130,11 @@ class ToolSet: def __len__(self) -> int: return len(self._tools) + def merge(self, other: "ToolSet") -> None: + """Merge another ToolSet into this one.""" + for tool in other.tools: + self.add(tool) + @property def tools(self) -> list[FunctionTool]: """List all tools in this set."""