ReActToolParser.get_tool_calls drops tool calls for zero-argument tools (falsy empty tool_params list)
ReActToolParser.get_tool_calls in
client-sdks/openapi/templates/python/lib/agents/react/tool_parser.py silently
drops any tool call for a tool that takes zero arguments.
The check is:
if tool_name and tool_params:
call_id = str(uuid.uuid4())
tool_calls = [
ToolCall(
call_id=call_id,
tool_name=tool_name,
arguments=json.dumps(params),
)
]tool_params is Action.tool_params: list[Param]. When the model emits a
valid ReAct action for a tool that has no parameters, tool_params is [],
which is falsy in Python. tool_name and tool_params then evaluates to
False even though tool_name is set and the action parsed correctly, so
the whole if block is skipped and get_tool_calls returns an empty list.
The caller has no way to distinguish this from "the model did not call a
tool" - the method returns [] in both cases. A zero-argument tool call
(for example list_files() or get_current_time()) is silently discarded.
Repro
from lib.agents.react.tool_parser import ReActToolParser, ReActOutput, Action
from lib.types import CompletionMessage
output = CompletionMessage(content=ReActOutput(
thought="I should list the files",
action=Action(tool_name="list_files", tool_params=[]),
answer=None,
).model_dump_json())
parser = ReActToolParser()
print(parser.get_tool_calls(output)) # [] - expected one ToolCall for list_filesExpected: a ToolCall for list_files with empty arguments ("{}").
Actual: an empty list, as if the model produced no action at all.
Fix: check tool_name is not None (or react_output.action is not None,
which is already checked one line above) instead of the truthiness of
tool_params. tool_params being [] is a valid, empty-but-present value,
not a missing one.
Source: ogx-ai/ogx