Fix JSONDecodeError when tool_call.arguments is empty string in AssistantAgent._execute_tool_call#7128
Fix JSONDecodeError when tool_call.arguments is empty string in AssistantAgent._execute_tool_call#7128linger118927 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
## Description
When using Claude models (or other LLM providers) with tool calling, the `tool_call.arguments`
field may be an empty string `""` instead of `"{}"` for tools that don't require parameters.
This causes a `JSONDecodeError[ in ](file://core/mt_llm_client.py#90#24)AssistantAgent._execute_tool_call` method, even though
the tool call is valid and should be executed with empty arguments.
## Current Behavior
```python
# In _assistant_agent.py line 1547
arguments = json.loads(tool_call.arguments) # Raises JSONDecodeError for ""
```
When `tool_call.arguments = ""`, this raises:
|
Orb Code Review (powered by GLM 5.1 on Orb Cloud) SummaryThis PR fixes a ArchitectureThe IssuesWarning — Redundant empty checkFile: The condition if not tool_call.arguments or not tool_call.arguments.strip():or even more concisely: if not tool_call.arguments or tool_call.arguments.isspace():This is minor and the current form works correctly — just noting for readability. Note — FunctionCall.arguments typingSeverity: suggestion
Cross-file impactNone directly. The fix is contained within AssessmentApprove ✅ — Clean, focused fix for a real bug. Empty tool call arguments from certain LLM providers would crash the agent, and this handles it gracefully. The approach is defensive and correct. |
Description
When using Claude models (or other LLM providers) with tool calling, the
tool_call.argumentsfield may be an empty string""instead of"{}"for tools that don't require parameters.This causes a
JSONDecodeError[ in ](file://core/mt_llm_client.py#90#24)AssistantAgent._execute_tool_callmethod, even though the tool call is valid and should be executed with empty arguments.Current Behavior
When
tool_call.arguments = "", this raises:Why are these changes needed?
Related issue number
Checks