diff --git a/agent.py b/agent.py index db7626b0eb..08b03864d1 100644 --- a/agent.py +++ b/agent.py @@ -978,8 +978,9 @@ async def validate_tool_request(self, tool_request: Any): raise ValueError("Tool request must be a dictionary") if not tool_request.get("tool_name") or not isinstance(tool_request.get("tool_name"), str): raise ValueError("Tool request must have a tool_name (type string) field") - if not tool_request.get("tool_args") or not isinstance(tool_request.get("tool_args"), dict): - raise ValueError("Tool request must have a tool_args (type dictionary) field") + # tool_args is optional - will default to empty dict in process_tools + if tool_request.get("tool_args") is not None and not isinstance(tool_request.get("tool_args"), dict): + raise ValueError("Tool args must be a dictionary if provided")