From 03c320bcd4f093935666ab4b5853fd6fa4b5e0b2 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Mon, 31 Mar 2025 13:42:35 +0200 Subject: [PATCH] Remove unnecessary *args from tool application function --- src/serena/agent.py | 4 ++-- src/serena/agno.py | 4 ++-- src/serena/mcp.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/serena/agent.py b/src/serena/agent.py index 4ceb321..36be883 100644 --- a/src/serena/agent.py +++ b/src/serena/agent.py @@ -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 diff --git a/src/serena/agno.py b/src/serena/agno.py index bf6a527..5017b07 100644 --- a/src/serena/agno.py +++ b/src/serena/agno.py @@ -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() diff --git a/src/serena/mcp.py b/src/serena/mcp.py index f240e85..98d52c7 100644 --- a/src/serena/mcp.py +++ b/src/serena/mcp.py @@ -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,