mirror of
https://github.com/tiennm99/serena.git
synced 2026-09-04 02:18:39 +00:00
Remove unnecessary *args from tool application function
This commit is contained in:
+2
-2
@@ -181,7 +181,7 @@ class Tool(Component):
|
||||
)
|
||||
return result
|
||||
|
||||
def apply_ex(self, *args, log_call: bool = True, catch_exceptions: bool = True, **kwargs) -> str: # type: ignore
|
||||
def apply_ex(self, log_call: bool = True, catch_exceptions: bool = True, **kwargs) -> str: # type: ignore
|
||||
"""
|
||||
Applies the tool with the given arguments
|
||||
"""
|
||||
@@ -192,7 +192,7 @@ class Tool(Component):
|
||||
if log_call:
|
||||
self._log_tool_application(inspect.currentframe())
|
||||
try:
|
||||
result = apply_fn(*args, **kwargs)
|
||||
result = apply_fn(**kwargs)
|
||||
except Exception as e:
|
||||
if not catch_exceptions:
|
||||
raise
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ from serena.agent import SerenaAgent, Tool
|
||||
|
||||
|
||||
def serena_tool_to_agno_function(tool: Tool) -> Function:
|
||||
def entrypoint(*args, tool=tool, **kwargs): # type: ignore
|
||||
tool.apply_ex(*args, log_call=True, catch_exceptions=True, **kwargs)
|
||||
def entrypoint(tool=tool, **kwargs): # type: ignore
|
||||
tool.apply_ex(log_call=True, catch_exceptions=True, **kwargs)
|
||||
|
||||
function = Function.from_callable(tool.get_apply_fn())
|
||||
function.name = tool.get_name()
|
||||
|
||||
+2
-2
@@ -57,9 +57,9 @@ def make_tool(
|
||||
func_arg_metadata = func_metadata(apply_fn)
|
||||
parameters = func_arg_metadata.arg_model.model_json_schema()
|
||||
|
||||
def execute_fn(ctx: Context, *args, **kwargs) -> str: # type: ignore
|
||||
def execute_fn(ctx: Context, **kwargs) -> str: # type: ignore
|
||||
mark_used(ctx)
|
||||
return tool.apply_ex(*args, log_call=True, catch_exceptions=True, **kwargs)
|
||||
return tool.apply_ex(log_call=True, catch_exceptions=True, **kwargs)
|
||||
|
||||
return MCPTool(
|
||||
fn=execute_fn,
|
||||
|
||||
Reference in New Issue
Block a user