Update src/plugin_system/base/base_tool.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
pull/1149/head
Windpicker-owo 2025-07-28 23:06:02 +08:00 committed by GitHub
parent 33f6377dad
commit a395573f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ class BaseTool:
Returns:
dict: 工具执行结果
"""
if not self.parameters.get("required") in function_args.keys():
raise ValueError(f"工具类 {self.__class__.__name__} 的参数 {self.parameters.get('required')} 必须在在调用时中提供")
if self.parameters and (missing := [p for p in self.parameters.get("required", []) if p not in function_args]):
raise ValueError(f"工具类 {self.__class__.__name__} 缺少必要参数: {', '.join(missing)}")
return await self.execute(function_args)