Add type check in safeParseToolCallArgs to handle cases where toolCall.function.arguments is already an object instead of a JSON string. This prevents parameter loss and 'argument is required' errors in tool calls.
Add type check in safeParseToolCallArgs to handle cases where toolCall.function.arguments is already an object instead of a JSON string. This prevents parameter loss and 'argument is required' errors in tool calls.